在升级到Android Studio 2.3后无法构建吗?

时间:2021-06-30 18:54:35

Two warnings show up when I try to build my project:

当我试图构建我的项目时,会出现两个警告:

Warning:Using incompatible plugins for the annotation processing: android-apt. This may result in an unexpected behavior.

警告:使用不兼容的插件来进行注释处理:android-apt。这可能会导致意想不到的行为。

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'

恰当的“com.jakewharton:butterknife-compiler:8.2.1”

to this:

:

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

annotationProcessor com.jakewharton:butterknife-compiler:8.2.1”

but it didn't work.

但它不工作。

4 个解决方案

#1


3  

You can down version of tools build gradle from 2.3.0 to 2.2.3 to avoid warning like that

您可以将工具构建级别从2.3.0降低到2.2.3,以避免类似的警告。

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

#2


7  

Just replace apt with annotationProcessor in your build.gradle file. And remove apt plugins wherever you see them.

在您的构建中只需要用注释处理器来替换apt。gradle文件。并删除apt插件,无论你在哪里看到它们。

#3


0  

Android apt is no longer supported in Android studio 2.3

Android studio 2.3中不再支持Android apt。

see https://bitbucket.org/hvisser/android-apt/issues/73/no-longer-compatible-with-gradle-at-v230

参见https://bitbucket.org/hvisser/android-apt/issues/73/no-longer-compatible-with-gradle-at-v230

#4


0  

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

在我更新。我也有这种情况。删除任何apt,如“com.neenbedankt.gradle.plugins:android-apt:1.8”从您的依赖类路径。

but before that.. please invalidate cache/restart AS and clean gradle.

但在此之前. .请取消缓存/重新启动,并清除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"
    }
}

#1


3  

You can down version of tools build gradle from 2.3.0 to 2.2.3 to avoid warning like that

您可以将工具构建级别从2.3.0降低到2.2.3,以避免类似的警告。

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

#2


7  

Just replace apt with annotationProcessor in your build.gradle file. And remove apt plugins wherever you see them.

在您的构建中只需要用注释处理器来替换apt。gradle文件。并删除apt插件,无论你在哪里看到它们。

#3


0  

Android apt is no longer supported in Android studio 2.3

Android studio 2.3中不再支持Android apt。

see https://bitbucket.org/hvisser/android-apt/issues/73/no-longer-compatible-with-gradle-at-v230

参见https://bitbucket.org/hvisser/android-apt/issues/73/no-longer-compatible-with-gradle-at-v230

#4


0  

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

在我更新。我也有这种情况。删除任何apt,如“com.neenbedankt.gradle.plugins:android-apt:1.8”从您的依赖类路径。

but before that.. please invalidate cache/restart AS and clean gradle.

但在此之前. .请取消缓存/重新启动,并清除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"
    }
}