Butterknife + kotlin:请求了增量注释处理,但是由于以下处理器不是增量处理器而被禁用了

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

我正在Kotlin中开发一个Android项目。

我的Gradle版本3.5.3

在我的应用程序模块build.gradle中,我添加了Butterknife依赖性:

implementation "com.jakewharton:butterknife:10.1.0"
annotationProcessor "com.jakewharton:butterknife-compiler:10.1.0"
kapt "com.jakewharton:butterknife-compiler:10.1.0"

但是我收到kotlin编译器警告:

enter image description here

w: [kapt] Incremental annotation processing requested, but support is disabled because the following processors are not incremental: butterknife.compiler.ButterKnifeProcessor (NON_INCREMENTAL).

在我的应用程序build.gradle文件中,我具有:

  android {
    ...
    compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
  }

为什么高于警告?我该如何解决?

((我也尝试在gradle.peroperties中添加kapt.incremental.apt=true。这无济于事。)

android gradle kotlin-android-extensions butterknife
2个回答
1
投票

增量注释处理必须由注释处理器本身支持,因此您不能对警告做太多事情。您可以尝试查看处理器的存储库,并向其维护者询问增量注释处理支持的ETA。

更新:我刚刚注意到,Butterknife支持增量处理,因此该问题与库无关。另一个假设kapt存在问题。本文可能对您有帮助:https://medium.com/@daniel_novak/making-incremental-kapt-work-speed-up-your-kotlin-projects-539db1a771cf


0
投票
 compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

将此添加到app.gradle文件中的android以下

© www.soinside.com 2019 - 2024. All rights reserved.