I have just updated my android Hilt-Dagger dependences to 1.0.0-alpha03
and I figure that ApplicationComponent
is deprecated
and replaced with SingletonComponent
but once I replace it at my code it shows up this error
Am I need to do anything else except replacing it?
Full Error
> Task :app:kaptDebugKotlin FAILED
error: [Hilt]
@DefineComponent dagger.hilt.components.SingletonComponent is missing a parent declaration.
Please declare the parent, for example: @DefineComponent(parent = ApplicationComponent.class)
[Hilt] Processing did not complete. See error above for details.error: [Hilt]
@DefineComponent dagger.hilt.components.SingletonComponent is missing a parent declaration.
Please declare the parent, for example: @DefineComponent(parent = ApplicationComponent.class)
[Hilt] Processing did not complete. See error above for details.error: [Hilt]
@DefineComponent dagger.hilt.components.SingletonComponent is missing a parent declaration.
Please declare the parent, for example: @DefineComponent(parent = ApplicationComponent.class)
[Hilt] Processing did not complete. See error above for details.error: [Hilt]
@DefineComponent dagger.hilt.components.SingletonComponent is missing a parent declaration.
[Hilt]
Please declare the parent, for example: @DefineComponent(parent = ApplicationComponent.class)
[Hilt] Processing did not complete. See error above for details.
Execution failed for task ':app:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
> java.lang.reflect.InvocationTargetException (no error message)
Thanks in advance.
Try updating your hilt-android-compiler to
kapt "com.google.dagger:hilt-android-compiler:2.37"
You're able to import the SingleComponent class, but kapt is failing to process it correctly.
It's important that both the hilt version and the kapt version match. Here is my current setup.
// HILT
def hilt_version = "2.37"
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
This happened to me when Android studio suggested an upgrade of hilt to 2.31 from 2.28. But it did not suggest for the kapt. Make sure both are 2.31.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With