Custom Android App Crashes

I have been working on this Android app and I’m running into an issue I can’t seem to figure out.

The app will occasionally crash with error java.lang.IllegalStateException but I can’t reproduce the crash easily.
Here are the full details:

Caused by: **java.lang.IllegalStateException** :
at io.particle.android.sdk.cloud.ParticleCloudSDK.verifyInitCalled (ParticleCloudSDK.java:63)
at io.particle.android.sdk.cloud.ParticleCloudSDK.getCloud (ParticleCloudSDK.java:33)
at com.example.DeviceListActivity.onCreate (DeviceListActivity.java:80)
 Async.executeAsync(ParticleCloudSDK.getCloud(), new Async.ApiWork<ParticleCloud, ParticleDevice>() {
            @Override
            public ParticleDevice callApi(@NonNull ParticleCloud ParticleCloud) throws ParticleCloudException, IOException {
                ParticleDevice device = ParticleCloud.getDevice(getIntent().getStringExtra(ARG_DEVICEID));



                return device;
            }

            @Override
            public void onSuccess(@NonNull ParticleDevice particleDevice) { // this goes on the main thread


                deviceNameView.setText(String.format("Name: %s", particleDevice.getName()));



            }



            @Override
            public void onFailure(@NonNull ParticleCloudException e) {



                Toaster.l(VariablesActivity.this, "Device Offline");
            
            }
        });

The crash seems to happen after I had the app running for some time, I rebooted the device in the meantime and I go back to open the app it crashes.

That stack trace should have included the error message from that exception:

"init not called before using the Particle SDK. Are you calling ParticleCloudSDK.init() in your Application.onCreate()?"

So... are you calling ParticleCloudSDK.init() in your Application.onCreate()? :slight_smile: