My dagger error message looked as follows:
error: [androidprocessor:miscerror]
dagger.android.processor.androidprocessor was unable to process this
class because not all of its dependencies could be resolved. check for
compilation errors or a circular dependency with generated code.
I also had this kapt error: java.lang.reflect.InvocationTargetException (no error message)
I was given which file dagger was not able to properly process, but no exact information on missing dependency. I applied all the fixes I found in this so. I had to carefully examine all the dependencies I could see in the generated by dagger file for which error was shown.
In my case it was dagger not able to find org.jetbrains.annotations.NotNull
. I noticed this dependency was upgraded, and due to some fixes I moved to use androidx.annotation.NonNull
in my code. I actually didnt depend on org.jetbrains.annotations
- it was being included from some other dependency. The error looked as follows:
found in modules jetified-annotations-12.0
(com.intellij:annotations:12.0) and jetified-annotations-16.0.1
(org.jetbrains:annotations:16.0.1)
I was resolving conflicts which ended up so that dependency was not visible by dagger.
As usual in such cases it was very usefull to see dependecy tree and where dependencies are comming from. Some dependencies were outdated and used org.jetbrains:annotations
in older version, and I had to either upgrade them or block this dependency from being included in my code with exclude, for example:
implementation ("io.reactivex.rxjava2:rxkotlin:$rxKotlinVersion") {
exclude group: 'org.jetbrains', module: 'annotations'
}
for dependency tree listing see here: How do I show dependencies tree in Android Studio?