Android Studio到3.0版本的com.jakewharton:butterknife:6.1.0问题

运行项目的时候报了这个错误:

Error:Execution failed for task ':app: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.

- butterknife-6.1.0.jar (com.jakewharton:butterknife:6.1.0)

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.

原因:

使用注解编译库,需要显示的声明,而我正在使用的butterknife是含有注解编译功能的,但是我的没有声明,所以导致变异错误。

解决办法:

android {

defaultConfig {

// 声明需要使用注解功能

javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }

...

}

}


作者:珠穆朗玛小王子

链接:http://www.jianshu.com/p/47bf8941c0ac

來源:简书

著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 173,860评论 25 709
  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    passiontim阅读 15,601评论 2 45
  • android studio 提示有3.0更新,强迫症就直接升级了,结果就尴尬了!出现问题然后就去找解决办法:看到...
    小小程序员jh阅读 5,409评论 0 1
  • 在Linux系统中,所有的进程都是 init 进程的子孙进程,即所有进程都是直接或者间接地由 init 进程 fo...
    卡路fly阅读 905评论 2 1
  • 说到慈悲,很多人会想到佛教,也确是如此,慈悲一词出自佛家,常听说我佛慈悲,便可得知。 慈为众生并给予快乐;同感其苦...
    郑雨阅读 1,441评论 4 13