-
Notifications
You must be signed in to change notification settings - Fork 2k
Cannot use new compiler with dagger.hilt.android.plugin #2086
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
Comments
Thanks! We can send out a patch for that soon. In the mean time, you can continue using |
Update the dependency check the Hilt Gradle Plguin does to consider the new coordinates of the Hilt compiler. Fixes: #2086 RELNOTES=Update Hilt Gradle Plugin to recognize hilt-compiler artifact. PiperOrigin-RevId: 330939237
Update: 2.29.1 should now be available with the fix. |
Still having this issue on a multi-module android project with android gradle plugin 4.1.0 |
Hi @ThanosFisherman, Can you check that you are using version Also check the error message for the failing Gradle module and verify that you've added the Hilt dependencies to that Gradle module. Note: You may need to go to the raw error message to find the failing Gradle module, as shown below: If none of that helps, we would need a sample project or more explicit steps to reproduce the problem. |
Hi @bcorso, Thanks for pointing me to the right direction. Upon second look I realized that I had some unwanted lines in my gradle scripts that would consequently cause hilt to throw this error. After deleting those lines everything builds without errors, but now I do get runtime errors that I wouldn't get with hilt
But I suppose the error above is unrelated with this issue. I'm also confused with the number of dependencies I should include as of the new hilt I use hilt gradle plugin in my root gradle build file
then in my app level gradle file I added the following
And that's all. I did not included the |
Sounds like you maybe did not use something like this class AuthViewModel @ViewModelInject constructor(
private val someDependency: SomeType
) : ViewModel() {} You're saying you included this: You actually need this dependency to enable that A few weeks ago I wrote a TLDR article with minimum setup of Dagger Hilt necessary, might be helpful to you to understand which dependencies you need to add: |
I'm already using Maybe I am missing something. I'll have a look at your article and if I still can't figure out what's causing this runtime crash, I'll create a sample project that reproduces this issue and post back. Probably I will open a new ticket as well. Thanks |
I'm also occurred this problem when migrating to Does it needs to invalidate caches & restart first? *or deleting gradle/caches |
Agreed. After updating, add missing hilt dependency, invalidating, cleaning & rebuilding it works in my case. |
Maybe , You didn,t have """ classpath "com.google.dagger:hilt-android-gradle-plugin:2.30.1-alpha""" in your dependencies |
O solved mine by adding the following dependencies // Dagger & Hilt |
@diegoflassa thanks, the only one thing that helped me here. |
Version: 2.29
As per release notes of Dagger 2.29 (https://github.com/google/dagger/releases/tag/dagger-2.29)
I've tried to change the
compiler
dependency to:This however doesn't work, if I have applied
dagger.hilt.android.plugin
. It says:The text was updated successfully, but these errors were encountered: