IllegalStateException Crashes

Hi,

After releasing recently based on Corona 3326 we’re getting a LOT of Android crashes on Android 8 (and a few on 8.1). Google Play is reporting it to us as:

java.lang.RuntimeException :

 

at android.app.ActivityThread.handleReceiver (ActivityThread.java:3397)

 

at android.app.ActivityThread.-wrap18 (Unknown Source)

 

at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1780)

 

at android.os.Handler.dispatchMessage (Handler.java:105)

 

at android.os.Looper.loop (Looper.java:164)

 

at android.app.ActivityThread.main (ActivityThread.java:6938)

 

at java.lang.reflect.Method.invoke (Native Method)

 

at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)

 

at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)

Caused by: java.lang.IllegalStateException :

 

at android.app.ContextImpl.startServiceCommon (ContextImpl.java:1538)

 

at android.app.ContextImpl.startService (ContextImpl.java:1484)

 

at android.content.ContextWrapper.startService (ContextWrapper.java:663)

 

at android.content.ContextWrapper.startService (ContextWrapper.java:663)

 

at com.ansca.corona.SystemStartupBroadcastReceiver.onReceive (SystemStartupBroadcastReceiver.java:29)

 

at android.app.ActivityThread.handleReceiver (ActivityThread.java:3390)

Anyone else getting this? Any ideas?

Thanks,

Nathan.

What plugins are you using?

Rob

gameanalytics

OneSignal

advertisingId

native.popup.social

notifications

googleAnalytics

analytics.flurry

gaemNetwork.google

CoronaSplashControl

OK, so the analytics are a bit over the top - could drop Flurry & GA, but have had them there forever and it hasn’t been a problem before.

Nathan.

Any ideas @robmiracle ?

What is this plugin: gaemNetwork.google?

Is there a more detailed stack trace on the crashes?  (please use pastebin.com or similar to share them)

Rob

Hi @robmiracle it’s this one (I just spelt it wrong above)…

https://docs.coronalabs.com/plugin/gameNetwork-google/index.html

Just noticed that it’s legacy and I’m pretty sure we’re not even using it in this app - was a hangover from an existing build.settings file.

That’s all the detail I have - it’s just from the Crash report on the Google Play console.

You certainly should probably avoid using “CoronaProvider.gameNetwork.google”. It was replaced by the GPGS plugin a long time ago and we recently updated it to GPGS v2 to be compliant with current Google requirements. If you’re not using it, I’d remove it. If you’re using it, you should switch to GPGS v2.

There is also a new notifications plugin, notifications v2 that uses Firebase Cloud Messaging (FCM) instead of Google Cloud Messaging (GCM) which is Google’s preferred way to send notifications. Though I don’t know that it should crash you.

As far as the stack trace, the Google Play developer console should let you drill down to see the specific error. 

Rob

Looks like we don’t ever require “gameNetwork” in the code, so I doubt that’s it, but I will replace.

Looking at how to get a bigger stack trace from GP.

Update: Google Play only provides what I pasted above

Interestingly we don’t have any user reports of the problem - could be something failing silently?

Why do you think it’s a plugin issue?

Any ideas on this @robmiracle ? We’re now at 8% crash rate on Google Play putting us waaaay over the bad behaviour threshold.

Any ideas?

I searched the forums for this error and there are threads around OneSignal and Notifications. 

I don’t know if you’ve switched from “notifications” to “notifications-v2” yet. I know that changes some backend processes for you. I know OneSignal has recently updated their plugin too. I don’t know how dependent you’re on those two plugins, but you could conduct a test and see if removing one or the other helps out.

Also, there is a thread that shows how to use OneSignal’s REST API instead of the plugin, which may be a long-term more stable approach to using OneSignal.

I have engineering looking at the post to come up with some better ideas.

Rob

Thanks Rob - will look into those two.

Looks like we’re still on legacy notifications as we’re still on Google Cloud Messaging - it says legacy will be supported, but maybe time for us to move that along

We should be maintaining that plugin as well. But that doesn’t mean Google isn’t changing something. What we need is to figure out if that’s the cause or not

Rob

OK - making that change in isolation to see if that’s the issue.

Have switched to Notifications v2 (which we are only using for local notifications) but now getting

Issue: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.XXX.XXX. Make sure to call FirebaseApp.initializeApp(Context) first.

Seems strange as the docs say we can do it without using Firebase if we’re not using it for Push https://docs.coronalabs.com/plugin/notifications-v2/registerForPushNotifications.html

We have the full log now. Is there a way I can share a log output with you @RobMiracle without exposing it publicly?

So the update is that I was able to build and get it to run with V2, but had to setup a Firebase app (even though it said we didn’t require it).

Will now deploy and see it it keeps getting the crash once live.

Deployed 24 hours ago and crashes are down 98% :slight_smile:

Will report back again in a few days, but at this stage it’s looking good.

Lessons are that Notifications v1 legacy is not longer working (despite docs saying legacy is supported) doc here: https://docs.coronalabs.com/plugin/notifications/index.html

Also Notifications v2 docs need updating (or the bug needs fixing) as it’s not possible to include it without a Firebase app setup (even with FCM set to false).

Doc is here: https://docs.coronalabs.com/plugin/notifications-v2/registerForPushNotifications.html

On iOS side, I had some problems too. I get these errors when I build my app:
 

Undefined symbols for architecture armv7: "\_deflate", referenced from: +[NSData(GTMZlibAdditionsPrivate) gtm\_dataByCompressingBytes:length:compressionLevel:mode:error:] in libGoogleToolboxForMac.a(GTMNSData+zlib\_fc602038fcf7c84186e822a98cfdc996.o) "\_deflateEnd", referenced from: +[NSData(GTMZlibAdditionsPrivate) gtm\_dataByCompressingBytes:length:compressionLevel:mode:error:] in libGoogleToolboxForMac.a(GTMNSData+zlib\_fc602038fcf7c84186e822a98cfdc996.o) "deflateInit2", referenced from: +[NSData(GTMZlibAdditionsPrivate) gtm\_dataByCompressingBytes:length:compressionLevel:mode:error:] in libGoogleToolboxForMac.a(GTMNSData+zlib\_fc602038fcf7c84186e822a98cfdc996.o) "\_inflate", referenced from: +[NSData(GTMZlibAdditionsPrivate) gtm\_dataByInflatingBytes:length:isRawData:error:] in libGoogleToolboxForMac.a(GTMNSData+zlib\_fc602038fcf7c84186e822a98cfdc996.o) "\_inflateEnd", referenced from: +[NSData(GTMZlibAdditionsPrivate) gtm\_dataByInflatingBytes:length:isRawData:error:] in libGoogleToolboxForMac.a(GTMNSData+zlib\_fc602038fcf7c84186e822a98cfdc996.o) "inflateInit2", referenced from: +[NSData(GTMZlibAdditionsPrivate) gtm\_dataByInflatingBytes:length:isRawData:error:] in libGoogleToolboxForMac.a(GTMNSData+zlib\_fc602038fcf7c84186e822a98cfdc996.o)

As additional information, I added these libraries to my Xcode project:
libFirebaseAnalytics,

libGoogleToolboxForMac
libFirebaseCore, libNotificationsV2Plugin
libFirebaseInstanceID, libProtobuf
libFirebaseMessaging

So we did that release and…  same problem.

Still getting lots of these:

java.lang.RuntimeException :

 

at android.app.ActivityThread.handleReceiver (ActivityThread.java:3399)

 

at android.app.ActivityThread.-wrap18 (Unknown Source)

 

at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1780)

 

at android.os.Handler.dispatchMessage (Handler.java:105)

 

at android.os.Looper.loop (Looper.java:164)

 

at android.app.ActivityThread.main (ActivityThread.java:6940)

 

at java.lang.reflect.Method.invoke (Native Method)

 

at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)

 

at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)

Caused by: java.lang.IllegalStateException :

 

at android.app.ContextImpl.startServiceCommon (ContextImpl.java:1538)

 

at android.app.ContextImpl.startService (ContextImpl.java:1484)

 

at android.content.ContextWrapper.startService (ContextWrapper.java:663)

 

at android.content.ContextWrapper.startService (ContextWrapper.java:663)

 

at com.ansca.corona.SystemStartupBroadcastReceiver.onReceive (SystemStartupBroadcastReceiver.java:29)

 

at android.app.ActivityThread.handleReceiver (ActivityThread.java:3392)

This is with Notifications V2? Are you still running oneSignal?