错误:java.util.concurrent.ExecutionException:com.android.builder.internal.aapt.v2.Aapt2Exception:AAPT2 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/49709023/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error:java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error
提问by sumit coolbuddy
How can I solve this problem, when I am building it, it is showing me the same problem- java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
我如何解决这个问题,当我构建它时,它向我展示了同样的问题 - java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
I am using classpath 'com.android.tools.build:gradle:3.1.0'
我正在使用类路径 'com.android.tools.build:gradle:3.1.0'
What should be the exact solution. Please let me know as soon as possible.
确切的解决方案应该是什么。请尽快告诉我。
回答by Bunty Rupela
- Open your build.gradle(app module)
- Please make sure you have buildToolsVersion available in your gradle file (if it is missing please make sure you have to add (buildToolsVersion) same version as of compileSdkVersion)
- 打开你的 build.gradle(app 模块)
- 请确保您的 gradle 文件中有可用的 buildToolsVersion(如果它丢失,请确保您必须添加(buildToolsVersion)与 compileSdkVersion 相同的版本)
回答by aolphn
error: invalid file path 'F:\AK-Android-Code\ak-im\build\intermediates\manifests\aapt\enterpriseArmV7\release\output.json'.
error: invalid file path 'F:\AK-Android-Code\ak-im\build\intermediates\manifests\aapt\enterpriseArmV7\release\AndroidManifest.xml'.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':ak-im:verifyEnterpriseArmV7ReleaseResources'.
> java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 11s
65 actionable tasks: 6 executed, 59 up-to-date
In my case,error info as above.I delete file folder F:\AK-Android-Code\ak-im\build\intermediates\manifests\aapt\ then rebuild project and it is successful. You can use ‘gradlew --debug assembleRelease ' check gradlew's output info.
就我而言,错误信息如上。我删除文件夹 F:\AK-Android-Code\ak-im\build\intermediates\manifests\aapt\ 然后重建项目并成功。您可以使用 'gradlew --debug assembleRelease ' 检查 gradlew 的输出信息。
回答by Derrick
There could be a problem in your res folders it could be an image that was not well converted so the solution to this is to update your gradle plugin which will highlight the actual problem
您的 res 文件夹中可能存在问题,可能是图像没有很好地转换,因此解决方案是更新您的 gradle 插件,这将突出显示实际问题
This line classpath 'com.android.tools.build:gradle:3.2.0-alpha18'
这条线 classpath 'com.android.tools.build:gradle:3.2.0-alpha18'
Edit your build.gradle file:
编辑您的 build.gradle 文件:
buildscript {
repositories {
google() // important!
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha18'
}
}
allprojects {
repositories {
google() // important!
jcenter()
}
}
NOTEThis might require to update your gradle to 4.6
注意这可能需要将您的 gradle 更新到 4.6
回答by Luke Skywalker
I had the same issue. Apparently this line had to be at the top of the main XML file and was 2 or 3 lines below.
我遇到过同样的问题。显然,这一行必须在主 XML 文件的顶部,在下面 2 或 3 行。
<?xml version="1.0" encoding="utf-8"?>
Cut and pasted to top of XML file and build succeeded.
剪切并粘贴到 XML 文件的顶部并成功构建。
回答by Binyam
Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
错误:java.util.concurrent.ExecutionException:com.android.builder.internal.aapt.v2.Aapt2Exception:AAPT2 错误:检查日志以获取详细信息
Solve it in the following way in the Gradle:
在Gradle中按以下方式解决:
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'+
this line
这条线
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
回答by cqLynnLee
I have the same problem as you and solved this problem this way:
我和你有同样的问题,通过这种方式解决了这个问题:
First, bulid a new "hello world" project in Android Studio and make sure it can correctly run. Then, open the build.gradle file to check the classpath. In my "hello world" project, the classpath is
首先,在 Android Studio 中构建一个新的“hello world”项目并确保它可以正确运行。然后,打开 build.gradle 文件以检查类路径。在我的“hello world”项目中,类路径是
classpath 'com.android.tools.build:gradle:3.5.1'
And then open the gradle-wrapper.properties file to check the distributionUrl.In my "hello world" project, the distributionUrl is
然后打开gradle-wrapper.properties文件查看distributionUrl。在我的“hello world”项目中,distributionUrl是
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
Finally, make the two configurations the same as "hello world" project in the imported project. The app could run correctly .
最后,将两个配置与导入项目中的“hello world”项目相同。该应用程序可以正常运行。

