Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

IllegalStateException Crashes
Started by beernathan Nov 04 2018 10:28 PM

48 replies to this topic
[TOPIC CONTROLS]
Page 1 of 2 1 2
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 357 posts
  • Corona SDK

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.



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,075 posts
  • Enterprise

What plugins are you using?

 

Rob



[TOPIC: post.html]
#3

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 357 posts
  • Corona SDK

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.



[TOPIC: post.html]
#4

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 357 posts
  • Corona SDK

Any ideas @robmiracle ?



[TOPIC: post.html]
#5

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,075 posts
  • Enterprise

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



[TOPIC: post.html]
#6

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 357 posts
  • Corona SDK

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.



[TOPIC: post.html]
#7

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,075 posts
  • Enterprise

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



[TOPIC: post.html]
#8

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 357 posts
  • Corona SDK

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?



[TOPIC: post.html]
#9

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 357 posts
  • Corona SDK

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?



[TOPIC: post.html]
#10

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,075 posts
  • Enterprise

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



[TOPIC: post.html]
#11

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 357 posts
  • Corona SDK

Thanks Rob - will look into those two.



[TOPIC: post.html]
#12

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 357 posts
  • Corona SDK

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



[TOPIC: post.html]
#13

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,075 posts
  • Enterprise

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



[TOPIC: post.html]
#14

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 357 posts
  • Corona SDK

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



[TOPIC: post.html]
#15

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 357 posts
  • Corona SDK

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?



[TOPIC: post.html]
#16

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 357 posts
  • Corona SDK

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.



[TOPIC: post.html]
#17

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 357 posts
  • Corona SDK

Deployed 24 hours ago and crashes are down 98% :-)

 

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


  • alireza.poorsohoolat likes this

[TOPIC: post.html]
#18

alireza.poorsohoolat

[GLOBAL: userInfoPane.html]
alireza.poorsohoolat
  • Observer

  • 29 posts
  • Corona SDK

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



[TOPIC: post.html]
#19

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 357 posts
  • Corona SDK

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)


[TOPIC: post.html]
#20

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,075 posts
  • Enterprise

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



[TOPIC: post.html]
#21

alireza.poorsohoolat

[GLOBAL: userInfoPane.html]
alireza.poorsohoolat
  • Observer

  • 29 posts
  • Corona SDK

I use pushwoosh, another bug is notification events received on Android 8+ but not shown on status bar.



[TOPIC: post.html]
#22

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 357 posts
  • Corona SDK

Yes @robmiracle Notifications v2 (this is a change) and OneSignal (no changes on this front).

 

Also note that OneSignal notifications are getting through to the new build.



[TOPIC: post.html]
#23

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 357 posts
  • Corona SDK

So OneSignal came back with...

 

"Are you only seeing this on Android 8+ devices? What Android API level are you targeting? This is the targetSdkVersion  in you build.gradle. Our current Corona SDK is only compatible with 25 and lower at this time. Lower it to 25 will allow your app to run on Android Oreo 8+ devices until we update our SDK.

We are looking to update our Corona SDK to match closer to our native Android SDK in an update next month which will allow targetSdkVersion 26+."

 

It is 8+ devices that we're seeing with the problem. Question is how do we change the target version in the Corona build process @robmiracle ?



[TOPIC: post.html]
#24

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,075 posts
  • Enterprise

You can roll-back to the last version of Corona before we released support for API level 27. The last public build, 3326 is the first version where we switched from 25 to 27. However, we have fixed a lot of ANR and Android crash problems in builds since 3326. You may be trading one problem for a host of others.

 

Also, I know for certain you cannot submit new apps that don't support 26+ and I'm pretty sure the window for updating apps with older versions has not passed. I don't believe that Google will allow apps that don't support 26+ any longer.

 

You are welcome to try to roll back to 3325 or earlier, but I'm not sure I would recommend that course of action.  My recommendations are:

 

1. Wait on OneSignal's update. I can't even begin to guess when that will be. Keeping pressure on this may speed things up.

2. Implement OneSignal's REST-based system. I'm not familiar with the process, but I know other community developers have worked this out and you can search the forums on how to do this.

3. Consider another provider.

 

Rob



[TOPIC: post.html]
#25

josh_OneSignal

[GLOBAL: userInfoPane.html]
josh_OneSignal
  • Enthusiast

  • 57 posts
  • Corona SDK

@Rob Miracle I believe the `java.lang.IllegalStateException` is being thrown from `com.ansca.corona.SystemStartupBroadcastReceiver.onReceive` based on @beernathan stack trace. So this looks to be something from Corona itself or one of Corona's Notification plugins, either V1 or V2.
 
The same stack trace was also reported by @zdmitrynsk on another thread;
https://forums.coronalabs.com/topic/72988-onesignal-with-targetsdkversion26-getting-error-background-start-not-allowed-service-intent-cmpcomonesignalgcmintentservicehas-extras/?p=390287
 
@karpovpw (Corona Staff) replied back with this update in Oct but no update since;
 

Actually, yes!

We've found inconsistencies in the new Android notification system. Our engineers are working on the solution, but I can't give you an ETA for now, stay tuned!

https://forums.coronalabs.com/topic/72988-onesignal-with-targetsdkversion26-getting-error-background-start-not-allowed-service-intent-cmpcomonesignalgcmintentservicehas-extras/?p=390616

 

Thanks.




[topic_controls]
Page 1 of 2 1 2
 
[/topic_controls]