AAPT2 gradle issue in android studio 3.0 beta4

我只是一个虾纸丫 提交于 2020-01-15 08:12:07

问题


Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details

We have already added android.enableAapt2=false in gradle.properties file


回答1:


For me, there was no need to add android.enableAapt2=false to my gradle.properties. The solution for me was to make sure that in my gradle build file my compileSdkVersion is set to 26, buildToolsVersion is set to 26.0.2 and targetSdkVersion is set to 26.

Note: In my build file, I had to do this check for all target and compile sdkVersions including product flavors:

  • mobile
  • tv

I am using Android Studio 3.0.1.




回答2:


Solved it mate finally

please update your compileSdkVersion to 26.That will solve your issue.I think so

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'

i have Solved it with increasing compileSDKVersion to 26




回答3:


For anyone who is still having issues, i.e loading up demos etc or importing projects. You need to make sure (like everyone else has stated):

You add the following statement to your gradle.properties file

android.enableAapt2=false

Now here is for the bit that they should have filled you in on. Chances are if you have imported a project there may not be a gradle.properties file this can be for a wide range of reasons old gradles being used auto fixing issues on build etc.

But seriously, If you can't find it right click in gradle scripts and click on new resource bundle and type gradle. This will create a gradle.properties just paste that code there and run the program. I would not use this as a permanent work around. I stumbled across this whilst importing a project that didn't have a gradle attached to the folder, normally making an app from scratch will have the properties file there.




回答4:


In my case it was caused by this line being missing from the Gradle dependencies:

implementation 'com.android.support.constraint:constraint-layout:1.1.0'




回答5:


For Cordova developers those working on android studio
I had faced this issue while changing the support library from com.android.support:appcompat-v7:23.0.0 to com.android.support:appcompat-v7:27.1.1 in order to support the foreground service feature of Android Oreo; to solve this add the following lines of code in build.gradle file `

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'

defaultConfig {
    minSdkVersion 26
    targetSdkVersion 27
      }
} 

After that comment following lines of code in build.gradle file. **Most important

cdvCompileSdkVersion cdvCompileSdkVersion
buildToolsVersion cdvBuildToolsVersion

Rebuild the project.




回答6:


Add to your gradle.properties file this line

android.enableAapt2=false

EDIT:

You should use stable verison of Android Studio 3



来源:https://stackoverflow.com/questions/47672425/aapt2-gradle-issue-in-android-studio-3-0-beta4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!