无法执行aapt

时间:2017-10-28 19:45:50

标签: build.gradle

请帮助解决此错误:

Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)
at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)
at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)
at sun.reflect.GeneratedMethodAccessor540.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)

4 个答案:

答案 0 :(得分:3)

对我而言,案件有点不同。我可以构建和调试未签名的APK。每次我尝试使用Jar签名进行签名发布时,都会出现此错误。重启android studio并没有解决它。

这就是我解决它的方法。

碰巧我的项目完整地址有空格。 D:\ Google Drive \ blah blah。 。 。将它更改为GoogleDrive,重新加载项目,问题就消失了。

答案 1 :(得分:3)

添加此行

android.enableAapt2=false

到gradle.properties文件

enter image description here

android.useDeprecatedNdk=true
android.enableAapt2=false
MYAPP_RELEASE_STORE_FILE=xxxxxxx
MYAPP_RELEASE_KEY_ALIAS=xxxxx
MYAPP_RELEASE_STORE_PASSWORD=xxxxxxxx
MYAPP_RELEASE_KEY_PASSWORD=xxxxxxxxx

答案 2 :(得分:0)

在package.json中添加插件“ cordova-android-support-gradle-release”。 它工作得很好。

答案 3 :(得分:0)

我遇到了同样的错误,但是cordova plugin add cordova-android-support-gradle-release为我工作。如果未安装,值得尝试。