在Android应用中集成Hilt环境遇到这样一个错误,@HiltAndroidApp to have a value. Did you forget to apply the Gradle Plugin
记录一下解决办法
下面是错误信息
public final class App extends android.app.Application {
^
Expected @HiltAndroidApp to have a value. Did you forget to apply the Gradle Plugin? (dagger.hilt.android.plugin)
See https://dagger.dev/hilt/gradle-setup.html
[Hilt] Processing did not complete. See error above for details.
解决办法:
defaultConfig {
javaCompileOptions { annotationProcessorOptions { arguments += [AROUTER_MODULE_NAME: project.getName()] arguments += ["room.schemaLocation": "$projectDir/schemas".toString()] } }
}
注意这里是+=号 ,以上。
本站内容来源于作者发布和网络转载,如有版权相关问题请及时与我们取得联系,我们将立即删除。