Dagger 2.12 -> runtime error when injecting application
See original GitHub issueAfter upgrading to 2.12 my android app crashes on startup with following stacktrace:
Failed resolution of: Lcom/google/common/collect/ImmutableMap;
at com.bejibx.android.mplaya.application.di.DaggerApplicationComponent.injectPlayerApplication(DaggerApplicationComponent.java:356)
at com.bejibx.android.mplaya.application.di.DaggerApplicationComponent.inject(DaggerApplicationComponent.java:342)
at com.bejibx.android.mplaya.application.di.DaggerApplicationComponent.inject(DaggerApplicationComponent.java:179)
at dagger.android.DaggerApplication.injectIfNecessary(DaggerApplication.java:78)
at dagger.android.DaggerApplication.onCreate(DaggerApplication.java:53)
at com.bejibx.android.mplaya.application.PlayerApplication.onCreate(PlayerApplication.java:33)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4806)
at android.app.ActivityThread.access$1600(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1452)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:234)
at android.app.ActivityThread.main(ActivityThread.java:5526)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.common.collect.ImmutableMap" on path: DexPathList[[zip file "/data/app/ru.bejibx.player-2/base.apk"],nativeLibraryDirectories=[/data/app/ru.bejibx.player-2/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.bejibx.android.mplaya.application.di.DaggerApplicationComponent.injectPlayerApplication(DaggerApplicationComponent.java:356)
at com.bejibx.android.mplaya.application.di.DaggerApplicationComponent.inject(DaggerApplicationComponent.java:342)
at com.bejibx.android.mplaya.application.di.DaggerApplicationComponent.inject(DaggerApplicationComponent.java:179)
at dagger.android.DaggerApplication.injectIfNecessary(DaggerApplication.java:78)
at dagger.android.DaggerApplication.onCreate(DaggerApplication.java:53)
at com.bejibx.android.mplaya.application.PlayerApplication.onCreate(PlayerApplication.java:33)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4806)
at android.app.ActivityThread.access$1600(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1452)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:234)
at android.app.ActivityThread.main(ActivityThread.java:5526)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Suppressed: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableMap
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 17 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
Probably because of
If you have Guava on your classpath, these will be implemented using ImmutableSet/ImmutableMap too
But I’m pretty sure I do not have guava on my classpath. Here is my dependencies list:
gradlew app:dependencies --configuration compile
+--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.50
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.50
| \--- org.jetbrains:annotations:13.0
+--- com.android.support:support-annotations:26.0.2
+--- com.android.support:design:26.0.2
| +--- com.android.support:support-v4:26.0.2
| | +--- com.android.support:support-compat:26.0.2
| | | \--- com.android.support:support-annotations:26.0.2
| | +--- com.android.support:support-media-compat:26.0.2
| | | +--- com.android.support:support-annotations:26.0.2
| | | \--- com.android.support:support-compat:26.0.2 (*)
| | +--- com.android.support:support-core-utils:26.0.2
| | | +--- com.android.support:support-annotations:26.0.2
| | | \--- com.android.support:support-compat:26.0.2 (*)
| | +--- com.android.support:support-core-ui:26.0.2
| | | +--- com.android.support:support-annotations:26.0.2
| | | \--- com.android.support:support-compat:26.0.2 (*)
| | \--- com.android.support:support-fragment:26.0.2
| | +--- com.android.support:support-compat:26.0.2 (*)
| | +--- com.android.support:support-core-ui:26.0.2 (*)
| | \--- com.android.support:support-core-utils:26.0.2 (*)
| +--- com.android.support:appcompat-v7:26.0.2
| | +--- com.android.support:support-annotations:26.0.2
| | +--- com.android.support:support-v4:26.0.2 (*)
| | +--- com.android.support:support-vector-drawable:26.0.2
| | | +--- com.android.support:support-annotations:26.0.2
| | | \--- com.android.support:support-compat:26.0.2 (*)
| | \--- com.android.support:animated-vector-drawable:26.0.2
| | +--- com.android.support:support-vector-drawable:26.0.2 (*)
| | \--- com.android.support:support-core-ui:26.0.2 (*)
| +--- com.android.support:recyclerview-v7:26.0.2
| | +--- com.android.support:support-annotations:26.0.2
| | +--- com.android.support:support-compat:26.0.2 (*)
| | \--- com.android.support:support-core-ui:26.0.2 (*)
| \--- com.android.support:transition:26.0.2
| +--- com.android.support:support-annotations:26.0.2
| \--- com.android.support:support-v4:26.0.2 (*)
+--- com.android.support:mediarouter-v7:26.0.2
| +--- com.android.support:appcompat-v7:26.0.2 (*)
| \--- com.android.support:palette-v7:26.0.2
| +--- com.android.support:support-compat:26.0.2 (*)
| \--- com.android.support:support-core-utils:26.0.2 (*)
+--- com.android.support:cardview-v7:26.0.2
| \--- com.android.support:support-annotations:26.0.2
+--- com.android.support:support-v13:26.0.2
| +--- com.android.support:support-annotations:26.0.2
| \--- com.android.support:support-v4:26.0.2 (*)
+--- com.android.support.constraint:constraint-layout:1.0.2
| \--- com.android.support.constraint:constraint-layout-solver:1.0.2
+--- com.google.dagger:dagger-android:2.12
| +--- com.google.dagger:dagger:2.12
| | \--- javax.inject:javax.inject:1
| +--- com.android.support:support-annotations:25.0.0 -> 26.0.2
| +--- com.google.code.findbugs:jsr305:3.0.1
| \--- javax.inject:javax.inject:1
+--- com.google.dagger:dagger-android-support:2.12
| +--- com.google.dagger:dagger:2.12 (*)
| +--- com.google.dagger:dagger-android:2.12 (*)
| +--- com.android.support:appcompat-v7:25.0.0 -> 26.0.2 (*)
| +--- com.android.support:support-annotations:25.0.0 -> 26.0.2
| +--- com.android.support:support-v4:25.0.0 -> 26.0.2 (*)
| +--- com.google.code.findbugs:jsr305:3.0.1
| \--- javax.inject:javax.inject:1
+--- com.jakewharton:butterknife:8.8.1
| +--- com.jakewharton:butterknife-annotations:8.8.1
| | \--- com.android.support:support-annotations:25.3.0 -> 26.0.2
| +--- com.android.support:support-annotations:25.3.0 -> 26.0.2
| \--- com.android.support:support-compat:25.3.0 -> 26.0.2 (*)
+--- com.github.bumptech.glide:glide:4.2.0
| +--- com.github.bumptech.glide:gifdecoder:4.2.0
| | \--- com.android.support:support-annotations:26.0.2
| +--- com.github.bumptech.glide:disklrucache:4.2.0
| \--- com.github.bumptech.glide:annotations:4.2.0
+--- com.arello-mobile:moxy:1.5.3
+--- frankiesardo:icepick:3.2.0
+--- io.reactivex.rxjava2:rxjava:2.1.5
| \--- org.reactivestreams:reactive-streams:1.0.1
+--- io.reactivex.rxjava2:rxandroid:2.0.1
| \--- io.reactivex.rxjava2:rxjava:2.0.1 -> 2.1.5 (*)
+--- com.afollestad.material-dialogs:core:0.9.4.7
| +--- com.android.support:support-annotations:26.0.1 -> 26.0.2
| +--- com.android.support:support-v13:26.0.1 -> 26.0.2 (*)
| +--- com.android.support:appcompat-v7:26.0.1 -> 26.0.2 (*)
| +--- com.android.support:recyclerview-v7:26.0.1 -> 26.0.2 (*)
| \--- me.zhanghai.android.materialprogressbar:library:1.4.1
| +--- com.android.support:appcompat-v7:25.3.1 -> 26.0.2 (*)
| \--- com.android.support:support-annotations:25.3.1 -> 26.0.2
+--- com.google.code.gson:gson:2.8.2
+--- com.google.android.exoplayer:exoplayer-core:r2.5.3
| \--- com.android.support:support-annotations:25.4.0 -> 26.0.2
+--- com.annimon:stream:1.1.9
+--- ru.terrakok.cicerone:cicerone:2.1.0
+--- com.jakewharton.timber:timber:4.5.1
+--- eu.davidea:flexible-adapter:5.0.0-rc2
+--- nz.bradcampbell:paperparcel:2.0.4
| +--- nz.bradcampbell:paperparcel-api:2.0.4
| | \--- com.android.support:support-annotations:25.0.1 -> 26.0.2
| \--- com.android.support:support-annotations:25.0.1 -> 26.0.2
+--- nz.bradcampbell:paperparcel-kotlin:2.0.4
\--- com.bluelinelabs:conductor:2.1.4
\--- com.android.support:support-annotations:25.3.1 -> 26.0.2
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:13
Top Results From Across the Web
Dagger 2.12 -> runtime error when injecting application
After upgrading to 2.12 my android app crashes on startup with following stacktrace:
Read more >Android Kotlin dagger 2 ViewModel injection error
So you get this error. class HomeFragmentViewModel @Inject constructor(): ViewModel(). I think this'll help you. ... kibar.app.ui.fragment.
Read more >If I had a quarter for every time I have seen this damn dagger ...
Dagger can't know what went wrong because this is a runtime error: something went off the rails when you tried to inject dependencies...
Read more >Introduction to Dependency Injection in Android using Dagger 2
To get started with dagger 2 in your application, add the following ... time error when a class not listed as injectable in...
Read more >Problem With Dagger 2 Android(Java.Lang ... - ADocLib
class FibonacciSequenceGenerator @Inject constructor @Binds was added in Dagger 2.12 specifically to improve performance. Build the app now and you'll get the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
hi guys, I fix this issue on my project with following config.
dependencies { … api ‘org.checkerframework:checker-compat-qual:2.5.3’ api ‘com.google.guava:guava:26.0-android’ … }
Well, I think I found the problem:
Should really be