AndroidStudio 3.0 canary 8 Annotation processors must be explicitly declared now.

本文介绍了如何解决在使用新版Android Studio编译旧项目时出现的编译错误问题,包括配置annotationProcessorOptions以及禁用AAPT2的方法。

今天由于开发环境问题,下载了最新版的AndroidStudio的,之前的项目编译报错,提示:


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.
    - permissionsdispatcher-processor-2.3.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.

在project/app/build.gradle的android{defaultConfig{}}中添加:

build.gradle

    apply plugin: 'com.android.application'

    ....
    androdi{
                defaultConfig{
                ....
                ...
                javaCompileOptions {
                annotationProcessorOptions {
                    includeCompileClasspath true
                }
        }
    }
}

—————————-2017年7月26日15:50:07————————————-

    Information:Gradle tasks [:app:assembleBaiduDebug]
C:\Users\Vincent\.gradle\caches\transforms-1\files-1.1\imagepicker-0.5.5.aar\2783c71f1a32429aa98ba1cbe71dc0ae\res\values\values.xml
Error:(22, 5) style attribute '@android:attr/windowEnterAnimation' not found
Error:(22, 5) style attribute '@android:attr/windowExitAnimation' not found
Error:(31, 5) style attribute '@android:attr/windowEnterAnimation' not found
Error:(31, 5) style attribute '@android:attr/windowExitAnimation' not found
Error:E:\MyProject\Hss\app\build\intermediates\incremental\mergeBaiduDebugResources\merged.dir\values\values.xml:1862 style attribute '@android:attr/windowEnterAnimation' not found
Error:E:\MyProject\Hss\app\build\intermediates\incremental\mergeBaiduDebugResources\merged.dir\values\values.xml:2545 style attribute '@android:attr/windowEnterAnimation' not found
Error:failed linking references
Error:java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:Execution failed for task ':app:processBaiduDebugResources'.
> Failed to execute aapt

解决方案:
关掉AAPT2即可
在Project/gradle.properties中添加 android.enableAapt2=false

    android.enableAapt2=false

这里写图片描述

——————–2017年7月27日09:49:33——–

评论 11
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值