We are getting the following error message from Retrofit when trying to call, sparkCloud.requestPasswordReset('email@example.com');
Here is the full error message.
11-14 13:37:28.255 11145-14917/com.twlighting.tw D/Retrofit: ---- ERROR
11-14 13:37:28.259 11145-14917/com.twlighting.tw D/Retrofit: java.lang.IllegalArgumentException: IdentityApi.requestPasswordReset: @Field parameters can only be used with form encoding. (parameter #1)
at retrofit.RestMethodInfo.methodError(RestMethodInfo.java:107)
at retrofit.RestMethodInfo.parameterError(RestMethodInfo.java:111)
at retrofit.RestMethodInfo.parseParameters(RestMethodInfo.java:356)
at retrofit.RestMethodInfo.init(RestMethodInfo.java:118)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:294)
at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240)
at java.lang.reflect.Proxy.invoke(Proxy.java:813)
at $Proxy1.requestPasswordReset(Unknown Source)
at io.particle.android.sdk.cloud.ParticleCloud.requestPasswordReset(ParticleCloud.java:490)
at com.twlighting.tw.profile.TWPasswordResetActivity$3.callApi(TWPasswordResetActivity.java:103)
at com.twlighting.tw.profile.TWPasswordResetActivity$3.callApi(TWPasswordResetActivity.java:99)
at io.particle.android.sdk.utils.Async$AsyncApiWorker.doInBackground(Async.java:111)
at io.particle.android.sdk.utils.Async$AsyncApiWorker.doInBackground(Async.java:79)
at android.os.AsyncTask$2.call(AsyncTask.java:304)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:762)
11-14 13:37:28.259 11145-14917/com.twlighting.tw D/Retrofit: ---- END ERROR
Thanks for the answer. We do not use Retrofit directly. We are using the Particle Setup Library to initiate the password reset.
Here is the error from the PasswordResetActivity.java
11-14 17:27:48.959 29696-29696/com.twlighting.tw E/Async: Error calling API: Unknown error communicating with server.
io.particle.android.sdk.cloud.ParticleCloudException
at io.particle.android.sdk.cloud.ParticleCloud.requestPasswordReset(ParticleCloud.java:492)
at io.particle.android.sdk.accountsetup.PasswordResetActivity$1.callApi(PasswordResetActivity.java:86)
at io.particle.android.sdk.accountsetup.PasswordResetActivity$1.callApi(PasswordResetActivity.java:83)
at io.particle.android.sdk.utils.Async$AsyncApiWorker.doInBackground(Async.java:111)
at io.particle.android.sdk.utils.Async$AsyncApiWorker.doInBackground(Async.java:79)
at android.os.AsyncTask$2.call(AsyncTask.java:304)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:762)
I get the Retrofit error when I set the http_log_level to FULL in strings.xml
That fixed the Password issue, however, we ran into another issue with DiscoverDevice activity. It happens right after the WiFi load when there are no Photons are nearby (0 results). I am posting the error log, do you have any idea why is it happening? FYI…we recently updated to Java 1.8
11-30 14:39:16.033 22120-22120/com.twlighting.tw E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.twlighting.tw, PID: 22120
java.lang.NoSuchMethodError: No virtual method io_particle_android_sdk_devicesetup_loaders_WifiScanResultLoader$$Lambda$2_lambda$new$0(Landroid/content/Context;Landroid/content/Intent;)V in class Lio/particle/android/sdk/devicesetup/loaders/WifiScanResultLoader; or its super classes (declaration of 'io.particle.android.sdk.devicesetup.loaders.WifiScanResultLoader' appears in /data/app/com.twlighting.tw-2/base.apk)
at io.particle.android.sdk.devicesetup.loaders.WifiScanResultLoader$$Lambda$2.onReceive(Unknown Source)
at io.particle.android.sdk.devicesetup.SimpleReceiver.onReceive(SimpleReceiver.java:46)
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1185)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Still trying to reproduce it. Tried to create new Android studio 3.0.1 project targeting Java 1.8 and Android sdk 27 with latest Particle libraries, called init and startDeviceSetup - works fine.
Few more questions:
Is multidex enabled?
Are you extending/customizing behavior of either sdk or setup libraries?
Any other gradle customizations?
Could you try to create new project and try setup & sdk libraries there?
Not the add device functionality. We customized the Login and Register pages however.
I am attaching the gradle file
I tried version switching support libraries, build tools version, and Invalidate Caches/Restart… Still getting the same issue. I see that particle is using retro-lambda. I am not very familiar with it to be honest.
I was crashing in PermissionsFragment Line 69. Any suggestions appreciated: