热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

AndroidStudio3.0Canary1注释处理器错误

如何解决《AndroidStudio3.0Canary1注释处理器错误》经验,为你挑选了2个好方法。

刚刚升级到Android Studio 3.0,之前正在编译的项目会抛出以下错误

错误:java.lang.RuntimeException:现在必须显式声明注释处理器.发现编译类路径中的以下依赖项包含注释处理器.请将它们添加到annotationProcessor配置中.

但是,这following没有定义.这是我的build.gradle中的compile语句的样子

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'

Abhishek Ban.. 22

原来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的评论改变compileimplementationprovidedcompileOnly



1> Abhishek Ban..:

原来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的评论改变compileimplementationprovidedcompileOnly



2> HungNM2..:

编译后看到错误信息.它将显示需要注释过程的包名称.例如:

Error:Execution failed for task ':MPChart_libary:javaPreCompileDebug'.
> Annotation processors must be explicitly declared now.  The following dependencies on the compile classpath are found to contain annotation processor.  Please add them to the annotationProcessor configuration.
    - realm-android-0.87.5.jar
  Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior.  Note that this option is deprecated and will be removed in the future.
  See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.

在模块"MPChart_libary"的build.gradle文件中搜索名称"realm-android-0.87.5":

dependencies {
    provided 'io.realm:realm-android:0.87.5' 
}

修复build.gradle文件如下:

dependencies {
    provided 'io.realm:realm-android:0.87.5' 
    annotationProcessor 'io.realm:realm-android:0.87.5' //fix here
}


推荐阅读
author-avatar
無名--小貞貞貞貞貞貞貞貞_微博_
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有