警告:任何处理器都无法识别以下选项:'[dagger.fastInit, kapt.kotlin. generated]'

问题描述 投票:0回答:4

当我尝试在 Android Studio 中运行或构建应用程序时收到此警告。为什么我会得到这个?我需要注意这个警告吗?

The following options were not recognized by any processor: '[dagger.fastInit, kapt.kotlin.generated]'
android warnings android-build dagger-hilt kapt
4个回答
123
投票

id "kotlin-kapt"
移至
plugins{}
模块级别中
build.gradle
的底部。


15
投票

当您编译多模块项目并且某些模块具有 kapt 但没有入口点时,就会发生这种情况。

问题已在此处进行了描述,但已修复此处

只需等到下一个 Android studio 版本发布或检查您是否拥有最新版本的剑柄和匕首


12
投票

对我来说,将其添加到构建文件(在 android 块中)修复了它:

hilt {
    enableAggregatingTask = true
}

参考:https://youtrack.jetbrains.com/issue/KT-46940/Kapt-reports-a-warning-The-following-options-were-not-recognized-by-any-processor...#focus =评论-27-5211169.0-0


0
投票

对我来说,解决方案是从仅使用以下注释的模块中的

kotlin-kapt
文件中删除
dagger.hilt.android.plugin
build.gradle

  • 来自
    dagger.hilt.android.qualifiers
    包(
    @ApplicationContext
    等)
  • 来自
    javax.inject
    包(
    @Inject
    @Singleton
    等)
plugins {
    alias(libs.plugins.com.android.library)
    alias(libs.plugins.kotlin.android)
    // ⬇️ remove these 2 plugins 
    id('dagger.hilt.android.plugin')
    id('kotlin-kapt')
    // ⬆️
}

dependencies {
    // …
    // leave it here to use @Inject or replace with javax.inject dependency
    implementation "com.google.dagger:hilt-android"
    // remove only this ⬇️
    kapt "com.google.dagger:hilt-android-compiler"
}
© www.soinside.com 2019 - 2024. All rights reserved.