com.android.builder.errors.EvalIssueException: The option ‘android.enableAapt2‘ is deprecated.

Build file 'D:\AndroidDemo\Mp4ToCamera\app\build.gradle' line: 2

An exception occurred applying plugin request [id: 'com.android.application']
> Failed to apply plugin 'com.android.internal.application'.
   > com.android.builder.errors.EvalIssueException: The option 'android.enableAapt2' is deprecated.
     The current default is 'true'.
     It has been removed from the current version of the Android Gradle plugin.
     This property has no effect, AAPT2 is now always used.

新建的一个项目,运行时出现如上所示错误,翻译过来是enableAapt2在当前Android Gradle插件中删除,此属性无效,现在始终使用AAPT2

解决方法:

到项目级build.gradle中修改gradle的版本为3.4.0:

原始代码:

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.2.2"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

修改后:

我通常都是修改为3.4.0可以正常运行,修改为3.4.0后点击右上角sync Now同步一下。

com.android.builder.errors.EvalIssueException: The option ‘android.enableAapt2‘ is deprecated._第1张图片

最后再重新安装一下即可

你可能感兴趣的:(Android,error,android)