Android Studio编译失败问题(aapt2)
程序员文章站
2024-01-16 22:42:28
android studio 3.1编译时出错:
org.gradle.api.tasks.taskexecutionexception: execution failed for task &...
android studio 3.1编译时出错:
org.gradle.api.tasks.taskexecutionexception: execution failed for task ':app:mergedebugresources'. at org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.executeactions(executeactionstaskexecuter.java:100) at org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.execute(executeactionstaskexecuter.java:70) at org.gradle.api.internal.tasks.execution.outputdirectorycreatingtaskexecuter.execute(outputdirectorycreatingtaskexecuter.java:51) at org.gradle.api.internal.tasks.execution.skipuptodatetaskexecuter.execute(skipuptodatetaskexecuter.java:62) at org.gradle.api.internal.tasks.execution.resolvetaskoutputcachingstateexecuter.execute(resolvetaskoutputcachingstateexecuter.java:54) at org.gradle.api.internal.tasks.execution.validatingtaskexecuter.execute(validatingtaskexecuter.java:60)
caused by: error: java.util.concurrent.executionexception: com.android.builder.internal.aapt.v2.aapt2exception: aapt2 error: check logs for details at com.android.ide.common.res2.mergedresourcewriter.end(mergedresourcewriter.java:332) at com.android.ide.common.res2.datamerger.mergedata(datamerger.java:301) at com.android.ide.common.res2.resourcemerger.mergedata(resourcemerger.java:412)
根据网上说的添加了android.enableaapt2=false,一开始都ok后来创建新项目又出了问题:
org.gradle.api.tasks.taskexecutionexception: execution failed for task ':app:transformdexwithinstantrundependenciesapkfordebug'. at org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.executeactions(executeactionstaskexecuter.java:100) at org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.execute(executeactionstaskexecuter.java:70) at org.gradle.api.internal.tasks.execution.outputdirectorycreatingtaskexecuter.execute(outputdirectorycreatingtaskexecuter.java:51) at org.gradle.api.internal.tasks.execution.skipuptodatetaskexecuter.execute(skipuptodatetaskexecuter.java:62)
根据查找说是修改一个android studiio 一个配置就可以,取消选中enable instant run :
修改之后真的可以运行了,但取消这个选中之后编写代码会非常麻烦,资源文件的引用非常麻烦,需要手写,还需要重新编译才能看出是否正确。
java.lang.runtimeexception: com.android.build.api.transform.transformexception: com.android.ide.common.process.processexception: failed to execute aapt at com.android.builder.profile.recorder$block.handleexception(recorder.java:55) at com.android.builder.profile.threadrecorder.record(threadrecorder.java:104)
最后查看log感觉还是aapt的问题,果然把android.enableaapt2=false 改为true就可以了。
附:一个提示编译时错误的方法 gradlew compiledebugjavawithjavac
上一篇: php7.0.13 pdo无法开启问题
推荐阅读
-
Android Studio Gradle编译 参数配置
-
php-screw在php5.4.6中编译失败问题
-
android源码编译android studio开发的apk
-
解决Android Studio4.1没有Gsonfomat插件,Plugin “GsonFormat” is incompatible的问题
-
【Android开发】Android Studio 打开AVD遇到的问题
-
Android Studio adb无法正常启动和真机调试遇见得问题
-
android studio 3.0.1依赖butterknife报错问题解决办法以及androidstudio2.0和3.0以上butterknife的配置大全
-
Mac OS下为Android Studio编译FFmpeg解码库的详细教程
-
Mac OS下为Android Studio编译FFmpeg解码库的详细教程
-
Android studio so库找不到问题解决办法