我最近一直在尝试将我的 Android 应用程序从 Dagger 迁移到 Hilt。
我想分阶段执行整个迁移,因此试图抑制不使用 @InstallIn 模块的 Hilt 警告。
一直在遵循此处给出的迁移指南:https : //dagger.dev/hilt/migration-guide.html
还找到了禁用 @InstallIn 检查的标志:https : //dagger.dev/hilt/compiler-options.html#disable-install-in-check
但是,我一直在努力让这个标志起作用。
为了更好地理解这个问题,我尝试将 Dagger Codelab ( https://codelabs.developers.google.com/codelabs/android-dagger/#0 )迁移到 Hilt。
即使在那里也没有找到成功。
有人可以指出错误吗?我附上了 build.gradle 文件和下面生成的错误。
项目级build.gradle文件
buildscript {
ext.kotlin_version = '1.3.61'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.dagger:hilt-android-gradle-plugin:2.28-alpha"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter() …Run Code Online (Sandbox Code Playgroud)