本文介绍了将android studio更新为3.0后,构建失败.错误:发现意外的光学范围(红色像素)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu中将Android Studio更新为3.0.当我加载项目时,它无法构建,并且在Android Studio的早期版本(v2.3)中构建时,该项目没有任何问题.错误说,

I updated my Android Studio to 3.0 in Ubuntu. When I loaded a project it fails to build and the same project has no issues when it was built in previous version(v2.3) of Android Studio. And the error says,

错误:.

错误:java.util.concurrent.ExecutionException:com.android.tools.aapt2.Aapt2Exception:AAPT2错误

Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error

推荐答案

最后,我发现了问题所在.这是由于我在项目资源中使用了大约9个补丁图标.我已经使用了一些第三方工具来绘制这些图标.现在,我将这些图标替换为使用Android Studio生成的图标(查看方法 ),一切对我来说都是正常的.

Finally I found out the problem. It was due to some 9 patch icons that I used in my project resources. I have made use of some 3rd party tool to draw these icons. Now I replaced those icons with that of the same generated using Android studio(see how) and everything is working for me.

如果您不想使用AAPT2,也可以.您可以按照@ capt.swag

Also if you don't want to use AAPT2. You can disable by setting android.enableAapt2=false in your gradle.properties file as suggested by @capt.swag

这篇关于将android studio更新为3.0后,构建失败.错误:发现意外的光学范围(红色像素)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 01:12