Android Studio 3.0 Canary 1 注释处理器错误

标签 android android-studio android-gradle-plugin

刚升级到Android Studio 3.0,之前编译的项目报如下错误

Error:java.lang.RuntimeException: Annotation processors must now be declared explicitly. The following dependencies in the compile classpath are found to contain annotation processors. Please add them to the annotationProcessor configuration.

然而,这个following 没有定义。这是我的 build.gradle 中的编译语句的样子

compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
    transitive = true;
}

compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'com.jakewharton.timber:timber:4.4.0'
compile 'io.reactivex:rxandroid:1.0.1'
compile 'io.reactivex:rxjava:1.0.14'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.jpardogo.googleprogressbar:library:1.2.0'
compile 'com.wang.avi:library:2.1.3'
compile 'link.fls:swipestack:0.3.0'
compile 'com.jakewharton:butterknife:8.4.0'
compile 'com.codemybrainsout.rating:ratingdialog:1.0.7'
compile 'org.greenrobot:greendao:3.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta5'
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
provided 'org.projectlombok:lombok:1.12.6'

最佳答案

原来是 LombokButterknife 导致了问题

我更新了 ButterKnife 并为 Lombok 添加了 annotationProcessor 解决了这个问题

implementation 'com.jakewharton:butterknife:8.6.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'

compileOnly 'org.glassfish:javax.annotation:10.0-b28'
compileOnly "org.projectlombok:lombok:1.16.16"
annotationProcessor "org.projectlombok:lombok:1.16.16"

更新

根据@Beshoy 的评论,将 compile 更改为 implementation 并将 provided 更改为 compileOnly

关于Android Studio 3.0 Canary 1 注释处理器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44084251/

相关文章:

android - 将图像添加到我的布局,其大小与屏幕 android 的尺寸成比例

java - IntelliJ/安卓工作室 : remove unnecessary use of 'this.'

android - 将Debug和Release构建发布到Aaven的Maven Local

Android gradle - 根据市场构建

android - 由于某些 .jar 依赖项,无法使用 ProGuard 编译应用程序的发布版本

java - 尝试调用虚方法 'java.lang.Object android.content.Context.getSystemService(java.lang.String)

Android MipMap - 如何在 XML 中创建图像资源

java - 使用自定义适配器在一个 ListView 中膨胀两个布局的问题

android - 使用谷歌云端点客户端库的 Android 应用程序的 Gradle 依赖项

android - Android Studio 0.8.6不会自动与Gradle文件同步