美文网首页
AndroidStudio升级Gradle3.0后的问题

AndroidStudio升级Gradle3.0后的问题

作者: 木水Code | 来源:发表于2017-10-27 10:35 被阅读74次

昨天升级了AndroidStudio3.0,gradle版本也升到了3.0,之前的老项目中ButterKnife不能用了,报错如下:


* Error:Execution failed for task ':neiquanlib: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-5.1.1.jar (butterknife-5.1.1.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.

根据错误提示,解决方法是在app的build.gradle中添加:


android{

             ......

defaultConfig{

             ......

            javaCompileOptions{

                      annotationProcessorOptions{

                                includeCompileClasspath=true

                      }

         }

  }

}

相关文章

网友评论

      本文标题:AndroidStudio升级Gradle3.0后的问题

      本文链接:https://www.haomeiwen.com/subject/wyrrpxtx.html