问题描述
这是我的 Gradle 控制台的输出,我无法构建我的项目
D:Android Projects....appsrcmain
eslayout opic_view_header.xml错误:错误:资源属性/??(又名 -packagename- :attr/??)未找到.错误:错误:资源属性/??(又名 -packagename-:attr/??)未找到.错误:错误:资源属性/??(又名 -packagename-:attr/??)未找到.错误:资源属性/??(又名 -packagename-:attr/??)未找到.错误:资源属性/??(又名 -packagename-:attr/??)未找到.错误:资源属性/??(又名 -packagename-:attr/??)未找到.错误:链接文件资源失败.错误:java.util.concurrent.ExecutionException:java.util.concurrent.ExecutionException:com.android.tools.aapt2.Aapt2Exception:AAPT2 错误:检查日志以了解详细信息错误:java.util.concurrent.ExecutionException:com.android.tools.aapt2.Aapt2Exception:AAPT2 错误:检查日志以了解详细信息错误:com.android.tools.aapt2.Aapt2Exception:AAPT2 错误:检查日志细节错误:任务:app:processDebugResources"的执行失败.>执行 aapt 失败信息:在 27 秒内构建失败信息:11个错误信息:0 条警告
Android Studio 3.0 RC 2
Update 2 (Follow this approach)
你现在不应该这样做.而是修复所有错误.这只是一个解决方法,直到它被删除.之后,您无论如何都需要手动修复错误.
尝试将您的 gradle 插件更新到 3.3.0-alpha06
以检查是否能解决您的问题.
更新 1:
非 ASCII 字符问题现已在 AAPT2 和 android gradle 插件中得到修复(耶!).现在您可以使用 android gradle 插件版本 3.2.0-alpha11 或更高版本,而不是禁用 AAPT2,您应该不会再遇到此错误.
原答案
当您使用 gradle 3.0 的 android 插件时,默认启用 Aapt2.
这是为了
改进增量资源处理
如此处所述.>
但是如果您遇到问题,您可以通过在 gradle.properties
android.enableAapt2=false
This is the output of my Gradle console, I am unable to build my project
D:Android Projects....appsrcmain
eslayout opic_view_header.xml
Error:error: resource attr/?? (aka -packagename- :attr/??) not found.
Error:error: resource attr/?? (aka -packagename-:attr/??) not found.
Error:error: resource attr/?? (aka -packagename-:attr/??) not found.
Error:resource attr/?? (aka -packagename-:attr/??) not found.
Error:resource attr/?? (aka -packagename-:attr/??) not found.
Error:resource attr/?? (aka -packagename-:attr/??) not found.
Error:failed linking file resources.
Error:java.util.concurrent.ExecutionException:
java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details
Error:Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt
Information:BUILD FAILED in 27s
Information:11 errors
Information:0 warnings
Android Studio 3.0 RC 2
Update 2 (Follow this approach)
You shouldn't do this now. Instead fix all the errors. This is only a workaround until it's removed. After that, you'll need to fix errors manually anyways.
Try to update your gradle plugin to 3.3.0-alpha06
to check if that fixes your issue.
Update 1:
Non-ascii characters issues have been fixed in AAPT2 and android gradle plugin now (yay!). Instead of disabling AAPT2 now you can just use android gradle plugin version 3.2.0-alpha11 or newer and you should not encounter this error anymore.
Original Answer
Aapt2 is enabled by default when you use android plugin for gradle 3.0.
This is to
as stated here.
But if you are facing issues with it, you can switch back to previous version by adding this in gradle.properties
android.enableAapt2=false
这篇关于错误:com.android.tools.aapt2.Aapt2Exception:AAPT2 错误:检查日志以了解详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!