-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update from 2.40.1 to 2.40.2 breaks build #3068
Comments
…tput. Incremental processing can change the order we receive elements in our metadata package. This CL sorts our metadata deps manually by file name before generating the @ComponentTreeDeps. Fixes #3006 RELNOTES=Fix #3006:Sort dependencies in ComponentTreeDeps manually to give consistent output. PiperOrigin-RevId: 411816413
Look this is a similar issue than #2675 In my case, the android plugin is declared in the root gradle files, and cause the use of javapoet 1.10. Adding a |
Hmm, the Hilt artifacts depend on JavaPoet 1.13, which includes that method. If you're getting a lesser version, then I think the solution lies in your build setup and may require some sort of dependency resolution to fix. As in #2675 (comment), looking at your dependencies may shed some light on what's bringing in a lesser version of JavaPoet. However, as I mentioned in that issue, I'm not familiar enough with Gradle to know why its normal resolution strategy (picking the highest version of a dependency) is not happening in this case. If you have any insight here, that would be helpful. Anyway, I'm going to close this since I don't think there's anything we can do about this in Hilt (but please correct me if I'm wrong). |
This is the Android Gradle Plugin which is pulling javapoet 1.10. The dependency resolution in Gradle is a giant blackbox almost impossible to debug, and very hard to get right. In my case, the root project was the one importing the Android Gradle Plugin (for obvious reason), but hilt where only declared in the app subproject. Why Gradle is not taking subproject into account to resolve dependency remain a mystery, but as I found a workaround, I'm not going to spend sanity point to investigate the root cause. |
Thanks for this bug report. Same for me. I've fixed with this workaround.
|
In my case, since I'm using dependencies {
implementation("com.android.tools.build:gradle:7.0.4")
implementation("com.android.tools.build:gradle-api:7.0.4")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
implementation("com.squareup:javapoet:1.13.0") // <-- added this
} |
Wow, thanks! Finally i can upgrade to 2.40.5 :) |
Another way, add configurations.all {
resolutionStrategy.eachDependency {
when {
requested.name == "javapoet" -> useVersion("1.13.0")
}
}
} |
This is needed for Kotlin 1.7.0 upgrade. Change also adds workaround for google/dagger#3068 that forces an upgrade of javapoet on the classpath. Test: ./gradlew assembleDebug Change-Id: I6a223ec83def02d8ccac7fa61e66d47f1dfccf06
I'm still having the issue. my project's
my app's
in summary: |
Hey @riccardogabellone, yesterday I had the same issue as you but I fixed the issue by matching hilt versions in project gradle file and app gradle file In your provided project's gradle file you have |
Hi, |
This is still valid with version 2.44 |
@gmazzo Oh thx for explain. |
Ohh you are going to ❤️ it, that's a Gradle Scan Just add |
dependencies {
implementation(libs.kgp)
implementation(libs.agp)
implementation("com.google.dagger:hilt-android-gradle-plugin:2.46.1")
} also works |
The only solution that helped me, thanks. |
Is this the cleaner solution? #4048 (comment) |
I changed |
When updating to 2.40.2, my build fails with the following error:
The text was updated successfully, but these errors were encountered: