Strangely activityInjector works for me on debug build but the app crashes for release builds. I have no clue why this might be happening. I tried disabling proguard rules and minification just to zero down on the issue but it didn’t help. Has anyone experienced a similar stackstace.

FATAL EXCEPTION: main
Process: fr.free.nrw.commons, PID: 7260
java.lang.RuntimeException: Unable to start activity ComponentInfo{fr.free.nrw.commons/fr.free.nrw.commons.contributions.ContributionsActivity}: java.lang.NullPointerException: fr.free.nrw.commons.CommonsApplication.activityInjector() returned null
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3160)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3275)
at android.app.ActivityThread.access$1000(ActivityThread.java:218)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1744)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:7007)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Caused by: java.lang.NullPointerException: fr.free.nrw.commons.CommonsApplication.activityInjector() returned null
at dagger.internal.Preconditions.checkNotNull(Preconditions.java:79)
at dagger.android.AndroidInjection.inject(AndroidInjection.java:56)
at fr.free.nrw.commons.contributions.ContributionsActivity.onCreate(ContributionsActivity.java:141)
at android.app.Activity.performCreate(Activity.java:6609)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1134)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3113)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3275)
at android.app.ActivityThread.access$1000(ActivityThread.java:218)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1744)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:7007)

Written by

Grad Student at ASU | Student Researcher at The Luminosity Lab | Ex Senior Software Engineer, Zeta | Volunteer, Wikimedia Foundation

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store