android / codelab-android-hilt

Apache License 2.0
346 stars 184 forks source link

Hilt compiling error: ApplicationComponent, expected to be annotated with @DefineComponent #10

Closed franklindjg closed 3 years ago

franklindjg commented 3 years ago

Compiling error:

> Task :app:kaptDebugKotlin FAILED
error: [Hilt]
  dagger.hilt.android.components.ApplicationComponent, expected to be annotated with @DefineComponent. Found: 
  [Hilt] Processing did not complete. See error above for details.error: [Hilt]
  dagger.hilt.android.components.ApplicationComponent, expected to be annotated with @DefineComponent. Found: 
[Hilt]

  [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)

Hilt dependencies used

build.gradle (Project)

dependencias {
    classpath 'com.google.dagger:hilt-android-gradle-plugin:2.28-alpha'
}

build.gradle (Module)

plugins {
    id 'kotlin-kapt'
    id 'dagger.hilt.android.plugin'
}

dependencies { 
    implementation "com.google.dagger:hilt-android:2.28.3-alpha"
    kapt "com.google.dagger:hilt-android-compiler:2.28-alpha"
}

Hilt annotations used

An application class annotated with:

@HiltAndroidApp

An activity class annotated with:

@AndroidEntryPoint
manuelvicnt commented 3 years ago

Hi! I believe you have to use the same version in the libraries and the gradle plugin. Can you try with:

dependencies {
    classpath 'com.google.dagger:hilt-android-gradle-plugin:2.28.3-alpha'
}
franklindjg commented 3 years ago

Hi @manuelvicnt

Using the same version in the libraries and gradle plugin solved the compiling error!

Thank you for the help!.

byrxs5216 commented 3 years ago

i met the same problem, but my libraries and gradle plugin had the same version

MONIBUR2002 commented 11 months ago

error1 error2