【发布时间】:2021-09-09 22:24:36
【问题描述】:
我已经在我的项目中实现了 Hilt 依赖项,但是当我的构造函数需要 @Inject 注释时,它不起作用。基本上,当我尝试手动导入它时,我发现 javax 中的注入文件夹是空的。所以结构就像javax.inject。之后我什么也得不到,因为注入文件夹是空的。我已经尝试重建和清理他的项目。我也尝试过使缓存无效,但似乎没有任何效果。我怎样才能完成这项工作?
依赖列表
dependencies {
implementation(project(":shared"))
implementation(AndroidX.appCompat)
implementation(Compose.runtime)
implementation(Compose.runtimeLiveData)
implementation(Compose.ui)
implementation(Compose.material)
implementation(Compose.uiTooling)
implementation(Compose.foundation)
implementation(Compose.compiler)
implementation(Compose.constraintLayout)
implementation(Compose.activity)
implementation(Compose.navigation)
implementation(Google.material)
implementation(Hilt.hiltAndroid)
implementation(Hilt.hiltNavigation)
kapt(Hilt.hiltCompiler)
implementation(Kotlinx.datetime)
debugImplementation(SquareUp.leakCanary)
}
刀柄版本 - 2.37
【问题讨论】:
-
您能在此处添加您的依赖列表吗?
-
是的,我已经用使用的依赖项更新了问题
-
@user477174 找到了任何解决方案,我遇到了同样的错误! Android Studio 4.2.2
-
这里出现同样的错误,你找到解决办法了吗?
-
我可以通过下载 android bumblebee 版本来“修复”它
标签: java android kotlin dagger-hilt kmm