You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ACRA might prevent the app from starting up on Android 8.0 and later in certain cases.
Versions tested: 5.0.2, 5.0.1, 4.10.0
Steps to reproduce:
Build an app using targetSdkVersion >= 26.
Qneue an error report (let the app crash or use handleException) and make sure the app is not running.
Invoke one of the app's services/receivers from the background (e.g. by sending a push notification).
The app will crash on startup.
Stack trace:
01-31 08:46:58.278 27051-27051/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.test, PID: 27051
java.lang.RuntimeException: Unable to instantiate application com.example.test.App: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.example.test/org.acra.sender.SenderService (has extras) }: app is in background uid UidRecord{1d6827c u0a331 RCVR bg:+1m15s763ms idle procs:2 seq(0,0,0)}
at android.app.LoadedApk.makeApplication(LoadedApk.java:984)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6103)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1715)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:180)
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:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:835)
Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.example.test/org.acra.sender.SenderService (has extras) }: app is in background uid UidRecord{1d6827c u0a331 RCVR bg:+1m15s763ms idle procs:2 seq(0,0,0)}
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1505)
at android.app.ContextImpl.startService(ContextImpl.java:1461)
at android.content.ContextWrapper.startService(ContextWrapper.java:644)
at org.acra.sender.SenderServiceStarter.startService(SenderServiceStarter.java:53)
at org.acra.util.ApplicationStartupProcessor.sendApprovedReports(ApplicationStartupProcessor.java:110)
at org.acra.util.ApplicationStartupProcessor.checkReports(ApplicationStartupProcessor.java:60)
at org.acra.ACRA.init(ACRA.java:234)
at org.acra.ACRA.init(ACRA.java:160)
at org.acra.ACRA.init(ACRA.java:144)
at com.example.test.App.attachBaseContext(App.java:69)
at android.app.Application.attach(Application.java:198)
at android.app.Instrumentation.newApplication(Instrumentation.java:1110)
at android.app.Instrumentation.newApplication(Instrumentation.java:1094)
at android.app.LoadedApk.makeApplication(LoadedApk.java:969)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6103)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1715)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:180)
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:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:835)
Cause: Starting from Android 8.0, startService will throw an IllegalStateException if the app is not in the foreground. This can be solved in multiple ways, one of them is migrating SenderService from IntentService to JobIntentService.
Note: passing checkReportsOnApplicationStart = false to ACRA.init also prevents the crash, but then the app itself will be responsible for sending queued reports in appropriate places. This might be difficult and also won't work well for widget-only apps.
The text was updated successfully, but these errors were encountered:
ACRA might prevent the app from starting up on Android 8.0 and later in certain cases.
Versions tested: 5.0.2, 5.0.1, 4.10.0
Steps to reproduce:
Stack trace:
Cause: Starting from Android 8.0, startService will throw an IllegalStateException if the app is not in the foreground. This can be solved in multiple ways, one of them is migrating SenderService from IntentService to JobIntentService.
Note: passing checkReportsOnApplicationStart = false to ACRA.init also prevents the crash, but then the app itself will be responsible for sending queued reports in appropriate places. This might be difficult and also won't work well for widget-only apps.
The text was updated successfully, but these errors were encountered: