question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@ContributesAndroidInjector broken - nondescript error

See original GitHub issue

Tried to use @ContributesAndroidInjector in a simplistic sample project but failed and no idea what the problem is. The sole build error is

dagger.internal.codegen.ComponentProcessor was unable to process this interface because not all of its dependencies could be resolved. Check for compilation errors or a circular dependency with generated code.
interface AppComponent extends AndroidInjector<MainApplication> {
^
1 error

I followed the documentation in creating my sample code. I have no errors when I replace the @ContributesAndroidInjector with the equivalent old-style code.

Same issue with UsesGeneratedModulesApplication from the Dagger repository, at least when I build it in a Gradle project.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:26

github_iconTop GitHub Comments

14reactions
sevar83commented, Jul 25, 2017

“Just incase anyone as dumb as me also comes across this thread”

Another dumbass in the party. You’re my life savior! I’m struggling since several hours! Who could expect that @ContributesAndroidInjector requires a separate artifact! If anyone in future sees the error message componentProcessor was unable to process this interface because not all of its dependencies could be resolved. Check for compilation errors or a circular dependency with generated code. the above could be the cause.

13reactions
Edijaecommented, Oct 6, 2017

Guys, I’m using kotlin in android studio. What was causing this error was because i was using annotationProcessor instead of kapt

 //dagger
implementation "com.google.dagger:dagger:$daggerVersion"
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
implementation "com.google.dagger:dagger-android:$daggerVersion"
implementation "com.google.dagger:dagger-android-support:$daggerVersion" // if you use the support libraries
annotationProcessor "com.google.dagger:dagger-android-processor:$daggerVersion"

Can you see the last line of code above? yah that one made me struggle for like 2 days. so,as i said, what was needed is kotlin application processing tool. a.k.a kapt and not annotationProcessor

//dagger
    implementation "com.google.dagger:dagger:$daggerVersion"
    kapt "com.google.dagger:dagger-compiler:$daggerVersion"
    implementation "com.google.dagger:dagger-android:$daggerVersion"
    implementation "com.google.dagger:dagger-android-support:$daggerVersion" // if you use the support libraries
    kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
Read more comments on GitHub >

github_iconTop Results From Across the Web

Bountysource
ContributesAndroidInjector broken - nondescript error.
Read more >
Error: @dagger.android.ContributesAndroidInjector was used ...
Go to your module level build.gradle , under. annotationProcessor 'com.google.dagger:dagger-android-processor:[YOUR VERSION NUMBER]' ,. add:.
Read more >
[Help] Generic, Dagger 2 Injected ViewModel : r/androiddev
But with Jetpack Navigation, it'd break unless the ViewModel is injected into a Fragment inside ... I keep getting nondescript build errors.
Read more >
Dagger 2 with ContributesAndroidInjector - Is it easy? - Medium
If we do not include this module in our root component compiler will generate an error stating can not be injected without @Provides...
Read more >
Dagger 2 Annotations: @Binds & @ContributesAndroidInjector
This article is a part of the “Dagger and the Dahaka” series. In this article we will briefly look at two annotations :...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found