1

since we all like it short&crisp:

I have an app in the store that produces a crash, that I can not reproduce (on 4 different android8 devices). According to GPlay it's a RuntimeException in the ActivityThread.handleReceiver and only in Android 8.x .

Since this only happens to "some" devices having the PlayStore version, I may guess it's because of ProGuard and/or signing. Also I do NOT use any Services/BroadcastReceiver in my App, since Android 8 has a startForegroundService instead of startService. In my app I use FusedLocationProviderClient and latest GPlay Service, but guess they should work flawlessly.

Stacktrace:

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:6944) 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 com.evernote.android.job.WakeLockUtil.startWakefulService (WakeLockUtil.java:95) at com.evernote.android.job.JobRescheduleService.startService (JobRescheduleService.java:24) at com.evernote.android.job.JobManager. (JobManager.java:191) at com.evernote.android.job.JobManager.create (JobManager.java:114) at com.evernote.android.job.JobBootReceiver.onReceive (JobBootReceiver.java:49) at android.app.ActivityThread.handleReceiver (ActivityThread.java:3392)

I already found a related thread here, that suggests extending the proGuardconfig, so I did - w/o a fix unfortunately:

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.preference.Preference
-keep public class * extends android.support.v4.app.Fragment
-keep public class * extends android.app.Fragment
  • Any hint and feedback is appreciated!
Thkru
  • 4,218
  • 2
  • 18
  • 37

1 Answers1

2

The hard thing about Android is that it is open source, which means lots of different versions on lots of different devices. The great thing about it though, is it is open source! Which means you can go to read the source code for your problems.

Here's how I debug crash reports like this:

  • I use Google to find the source code "ContextImpl.java startServiceCommon android source"
  • Interestingly while doing this I found someone else with the issue here It looks like the evernote android-job library had a bug. From Android O, background tasks must call Context.startForegroundService instead of Context.startService. Do you need to upgrade a library?
  • if I hadn't found this I would have looked at the source code.
    • if you click on [blame] at the top of that page you can see this code was added here
    • the description for the change tells you that it is to do with finding processes starting things running in the background when they shouldn't.
  • there seems to be some more good answers on this StackOverflow question
Nick Fortescue
  • 13,530
  • 1
  • 31
  • 37