刚升级到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'
最佳答案
原来是 Lombok
和 Butterknife
导致了问题
我更新了 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/