0

I am trying to setup an Android MVPApp & have setup Dagger 2, butterknife successfully in my project & it is working with all activities on my device but still the android's firebase crashlytics is still showing several users with Android 19 & below version affected with the issue. Here's the stack trace from firebase console -

com.urtutors.eduwiser.data.db.DbOpenHelper_Factory.get (DbOpenHelper_Factory.java:35)
com.urtutors.eduwiser.data.db.DbOpenHelper_Factory.get (DbOpenHelper_Factory.java:10)
dagger.internal.DoubleCheck.get (DoubleCheck.java:47)
com.urtutors.eduwiser.data.db.AppDbHelper_Factory.get (AppDbHelper_Factory.java:21)
com.urtutors.eduwiser.data.db.AppDbHelper_Factory.get (AppDbHelper_Factory.java:7)
dagger.internal.DoubleCheck.get (DoubleCheck.java:47)
com.urtutors.eduwiser.di.module.ApplicationModule_ProvideDbHelperFactory.get (ApplicationModule_ProvideDbHelperFactory.java:30)
com.urtutors.eduwiser.di.module.ApplicationModule_ProvideDbHelperFactory.get (ApplicationModule_ProvideDbHelperFactory.java:10)
dagger.internal.DoubleCheck.get (DoubleCheck.java:47)
com.urtutors.eduwiser.data.AppDataManager_Factory.get (AppDataManager_Factory.java:43)
com.urtutors.eduwiser.data.AppDataManager_Factory.get (AppDataManager_Factory.java:11)
dagger.internal.DoubleCheck.get (DoubleCheck.java:47)
com.urtutors.eduwiser.di.module.ApplicationModule_ProvideDataManagerFactory.get (ApplicationModule_ProvideDataManagerFactory.java:30)
com.urtutors.eduwiser.di.module.ApplicationModule_ProvideDataManagerFactory.get (ApplicationModule_ProvideDataManagerFactory.java:10)
dagger.internal.DoubleCheck.get (DoubleCheck.java:47)
com.urtutors.eduwiser.MvpApp_MembersInjector.injectMembers (MvpApp_MembersInjector.java:38)
com.urtutors.eduwiser.MvpApp_MembersInjector.injectMembers (MvpApp_MembersInjector.java:9)
com.urtutors.eduwiser.di.component.DaggerApplicationComponent.inject (DaggerApplicationComponent.java:192)
com.urtutors.eduwiser.MvpApp.onCreate (MvpApp.java:55)
android.app.Instrumentation.callApplicationOnCreate (Instrumentation.java:1013)
android.app.ActivityThread.handleBindApplication (ActivityThread.java:4730)
android.app.ActivityThread.access$1600 (ActivityThread.java:175)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1368)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:146)
android.app.ActivityThread.main (ActivityThread.java:5602)
java.lang.reflect.Method.invokeNative (Method.java)
java.lang.reflect.Method.invoke (Method.java:515)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1283)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1099)
dalvik.system.NativeStart.main (NativeStart.java)

Here's the issue summary from firebase console -

enter image description here

The stacktrace suggests issue originated from MvpApp.java so here's the error source in line 55 -

Line 55

The stack trace suggests that the error is coming when it fails to inject dagger component to main app here -

mApplicationComponent = DaggerApplicationComponent.builder()
                .applicationModule(new ApplicationModule(this)).build();

        mApplicationComponent.inject(this);

So, can anyone help me identify, debug or fix this issue.

I tried searching the issue around & found this -

Inject database in a ContentProvider with dagger

which has a suggested answer to move component initialization to attachbasecontext method instead of onCreate, I wanted to try this solution but I do not understand how to get instance of YourMainApplication

to call YourMainApplication.get(context).inject(this);

Harshit Laddha
  • 2,044
  • 8
  • 34
  • 64

1 Answers1

0

Log is not enough but, it seems like you have circular dependency injection. You could check injections on your classes.

For example

public class A {
   @Inject 
   B classB; 

}

public class B {
   @Inject
   A classA; // this injection creates circular injection and also can cause stackoverflow exception
}

You must avoid this situation.

demdem
  • 182
  • 3
  • 14