简体   繁体   English

更新到Android Studio 2.3后无法构建

[英]Can't build after updating to Android Studio 2.3

Two warnings show up when I try to build my project: 当我尝试构建项目时会显示两个警告:

Warning:Using incompatible plugins for the annotation processing: android-apt. 警告:使用不兼容的插件进行注释处理:android-apt。 This may result in an unexpected behavior. 这可能会导致意外的行为。

and also at the end of all the binding errors: 以及所有绑定错误的结尾:

Warning:The following options were not recognized by any processor: '[android.databinding.artifactType, android.databinding.printEncodedErrors, android.databinding.minApi, android.databinding.isTestVariant, android.databinding.enableDebugLogs, android.databinding.sdkDir, android.databinding.bindingBuildFolder, android.databinding.enableForTests, android.databinding.modulePackage, android.databinding.generationalFileOutDir, android.databinding.xmlOutDir]' 警告:以下任何处理器均无法识别以下选项:'[[android.databinding.artifactType,android.databinding.printEncodedErrors,android.databinding.minApi,android.databinding.isTestVariant,android.databinding.enableDebugLogs,android.databinding.sdkDir, android.databinding.bindingBuildFolder,android.databinding.enableForTests,android.databinding.modulePackage,android.databinding.generationalFileOutDir,android.databinding.xmlOutDir]”

I tried to enable annotation processors and removed all apt reference and changed this: 我尝试启用注释处理器,并删除了所有apt引用,并对此进行了更改:

apt 'com.jakewharton:butterknife-compiler:8.2.1' apt'com.jakewharton:butterknife-compiler:8.2.1'

to this: 对此:

annotationProcessor 'com.jakewharton:butterknife-compiler:8.2.1' 注解处理器'com.jakewharton:butterknife-compiler:8.2.1'

but it didn't work. 但这没用。

Just replace apt with annotationProcessor in your build.gradle file. 只需在build.gradle文件中将apt替换为annotationProcessor处理器即可。 And remove apt plugins wherever you see them. 并在任何地方删除apt插件。

您可以将工具build gradle的版本从2.3.02.2.3以避免类似的警告

classpath 'com.android.tools.build:gradle:2.2.3'

after i update. 我更新之后。 i also have this kind of situation. 我也有这种情况。 Remove any apt like "com.neenbedankt.gradle.plugins:android-apt:1.8" from your dependencies classpath 从依赖项类路径中删除任何类似"com.neenbedankt.gradle.plugins:android-apt:1.8"

but before that.. please invalidate cache/restart AS and clean gradle. 但在此之前..请使缓存/重启AS无效并清理gradle。

then 然后

dependencies {
     classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1'
}

then 然后

apply plugin: 'com.jakewharton.butterknife'

then 然后

compile "com.jakewharton:butterknife:8.5.1",
annotationProcessor "com.jakewharton:butterknife-compiler:8.5.1"

the lastly..put this in last app module 最后..将此放在最后一个应用程序模块中

configurations.all {
    resolutionStrategy {
        force "com.android.support:support-annotations:25.2.0"
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM