Unresolved reference. Forced to clean build after code changes
See original GitHub issueHi, I am having some problems with Hilt dependency injection. If I clean the project and build, it builds just fine. But gives me ‘Unresolved reference’ on a bunch of my injected view models if I change anything in my activities/fragments and try and build again without cleaning. Some builds also trigger a circular dependency error, but I cannot figure out where the should be occuring.
I have tried all different kinds of configurations in my gradle files, to no avail, I have tried to paste my configuration with the parts concerning dagger and gradle below:
build.gradle file
buildscript {
ext.kotlin_version = '1.5.10'
ext.hilt_version = '2.37'
repositories {
google()
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
}
}
build.gradle app file
plugins {
id("dagger.hilt.android.plugin")
}
dependencies {
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
}
I get the following error messages on subsequent builds, either unresolved reference or dependency cycle
Any help would be appreciated. I have exhausted a lot of different options by now.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9
Top GitHub Comments
I finally solved it! I am also using apollo-android to generated my types, mutations and queries for usage within my android project. In the Apollo schema directory I had a subfolder called
User
, I also had a package in my android project calleduser
. This leads to two separate generated folders upon compilation, which for some unbeknownst reason works in the initial builds (or if changes are applied to all files in the package with identical naming) but not in subsequent builds.I have created a question on the apollo-android repo, trying to explain the error in more detail. I do not know where to go from here, but I just wanted to share the problem in case anyone else had this very undescriptive error message.
apollo-android question: https://github.com/apollographql/apollo-android/issues/3306
Best regards Jørgen.
@jorgenfaunaapp just to confirm, after enabling correctErrorTypes are you still seeing the Dagger/DependencyCycle error? If so can you post the updated stacktrace without the NonExistentClass?
For the unresolved references, I don’t see anything relating it to Hilt. Do you have a reason to suspect that this is related to Hilt?