Android SDK getDevices NullPointerException

Hi All,

I’m getting an odd error with release 3.4 of the Android SDK. For some reason whenever it tries to get one of my devices I get a nullpointerexception that crashes the whole app.

It looks like it’s getting anull returned from one of my variables… But it’s not null… and I can read it just fine from other sources (REST API, and the Spark Atom IDE…

It also seems to work fine with older versions of the SDK. Anyone else seeing similar issues? (The device in question is Spark, not a photon if that makes any difference…)

"FATAL EXCEPTION: AsyncTask #1
Process: screamingcities.com.autohomeultra, PID: 11659
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.NullPointerException: null value in entry: cMode=null
at com.google.common.collect.CollectPreconditions.checkEntryNotNull(CollectPreconditions.java:33)
at com.google.common.collect.RegularImmutableMap.(RegularImmutableMap.java:88)
at com.google.common.collect.ImmutableMap.copyOf(ImmutableMap.java:294)
at io.particle.android.sdk.cloud.ParticleCloud.fromCompleteDevice(ParticleCloud.java:580)
at io.particle.android.sdk.cloud.ParticleCloud.getDevice(ParticleCloud.java:534)
at io.particle.android.sdk.cloud.ParticleCloud.getDevice(ParticleCloud.java:530)
at io.particle.android.sdk.cloud.ParticleCloud.getDevices(ParticleCloud.java:227)
at screamingcities.com.autohomeultra.FragmentRemoteLights$2.callApi(FragmentRemoteLights.java:72)
at screamingcities.com.autohomeultra.FragmentRemoteLights$2.callApi(FragmentRemoteLights.java:69)
at io.particle.android.sdk.utils.Async$AsyncApiWorker.doInBackground(Async.java:105)
at io.particle.android.sdk.utils.Async$AsyncApiWorker.doInBackground(Async.java:73)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

@screamingcities thanks for the post. I would suggest you try posting this as a GitHub issue on the Android SDK GitHub repo. I think you’ll get a faster answer over there and it’ll help anyone who is having similar problems with the SDK

Thanks- I’ll give it a try.