Android Studio编译失败问题(aapt2)
程序员文章站
2022-05-01 17:46:42
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
上一篇: 春秋时期的齐国第一个就崛起了,为什么没能统一全国呢?
下一篇: 1618域名平台崩盘:涉及上亿资金
推荐阅读
-
解决android studio 3.0 加载项目过慢问题--maven仓库选择
-
Android Studio的中文乱码问题解决方法
-
Android Studio导入Eclipse项目失败该怎么办?
-
解决Mono For Android不能编译问题:Could not create the Android package
-
Android Studio控制台出现中文乱码(方框)问题解决办法
-
详解升级Android Studio3.0时遇到的几个问题
-
详解Android studio 3+版本apk安装失败问题
-
Android studio 下的APK打包失败问题解决办法
-
Android Studio怎么解决导入项目的中文注释乱码的问题?
-
Android 编译出错版本匹配问题解决办法