Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v.5.1.0: Sending reports from Application.attachBaseContext causes a crash #636

Closed
ZimM-LostPolygon opened this issue Feb 8, 2018 · 2 comments

Comments

@ZimM-LostPolygon
Copy link

ZimM-LostPolygon commented Feb 8, 2018

Since 5.1.0, ACRA uses JobIntentService for SenderService. However, JobIntentService.CompatWorkEnqueuer (for pre-Oreo devices) constructor does this:

mContext = context.getApplicationContext();

as result, mContext is null, so everything else fails. This is probably an issue with the support library itself, but for ACRA, this means that ACRA.init can't be called in Application.attachBaseContext anymore.

Calling ACRA.init from Application.onCreate instead makes everything work again.

@F43nd1r
Copy link
Member

F43nd1r commented Feb 8, 2018

Cannot reproduce.

SenderService should not be called in init anyway. Please detail your setup.

@ZimM-LostPolygon
Copy link
Author

ZimM-LostPolygon commented Feb 8, 2018

SenderService should not be called in init anyway.

It does when there are unsent crash reports. Here's the full stacktrace:

ACRA caught a RuntimeException for com.ballasttechnologies.android.triton
java.lang.RuntimeException: Unable to instantiate application com.ballasttechnologies.android.triton.core.MainApp: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.ComponentName android.content.Context.startService(android.content.Intent)' on a null object reference
    at android.app.LoadedApk.makeApplication(LoadedApk.java:802)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5335)
    at android.app.ActivityThread.-wrap2(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6077)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
 Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.ComponentName android.content.Context.startService(android.content.Intent)' on a null object reference
    at android.support.v4.app.JobIntentService$CompatWorkEnqueuer.enqueueWork(JobIntentService.java:181)
    at android.support.v4.app.JobIntentService.enqueueWork(JobIntentService.java:522)
    at android.support.v4.app.JobIntentService.enqueueWork(JobIntentService.java:500)
    at org.acra.sender.SenderServiceStarter.startService(SenderServiceStarter.java:54)
    at org.acra.util.ApplicationStartupProcessor.sendApprovedReports(ApplicationStartupProcessor.java:106)
    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 com.ballasttechnologies.android.triton.log.CrashReportingConfigurator.execute(CrashReportingConfigurator.java:42)
    at com.ballasttechnologies.android.triton.core.MainApp.initAcra(MainApp.java:63)
    at com.ballasttechnologies.android.triton.core.MainApp.attachBaseContext(MainApp.java:51)
    at android.app.Application.attach(Application.java:189)
    at android.app.Instrumentation.newApplication(Instrumentation.java:1008)
    at android.app.Instrumentation.newApplication(Instrumentation.java:992)
    at android.app.LoadedApk.makeApplication(LoadedApk.java:796)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5335) 
    at android.app.ActivityThread.-wrap2(ActivityThread.java) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:154) 
    at android.app.ActivityThread.main(ActivityThread.java:6077) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants