LoginSignup
1
0

More than 1 year has passed since last update.

[Android] HiltでApplicationComponentが見つからない

Posted at

Hiltのcodelab Android アプリでの Hilt の使用 で、以下のエラーが発生しました。

エラー: シンボルを見つけられません
@dagger.hilt.InstallIn(value = {ApplicationComponent.class})
                                ^
シンボル: クラス ApplicationComponent

原因

Hiltのバージョンを最新の2.38.1にしていたことが原因で、エラーが発生していました。

修正

Hiltのバージョンをcodelabで指定されている2.28-alpha、または2.28.3-alphaにすることで解決しました。

build.gradle
buildscript {
    ext.kotlin_version = '1.5.21'
    ext.hilt_version = '2.28-alpha'
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
    }
}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0