本文介绍了错误:com.android.tools.aapt2.Aapt2Exception:AAPT2错误:查看日志以了解详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的Gradle控制台的输出,我无法构建我的项目

This is the output of my Gradle console, I am unable to build my project

D:\Android Projects\....\app\src\main\res\layout\topic_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

Android Studio 3.0 RC 2

推荐答案

更新2(遵循此方法)

您现在不应该这样做.而是解决所有错误.除非将其删除,否则这只是一个解决方法.之后,您仍然需要手动修复错误.

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.

尝试将gradle插件更新为3.3.0-alpha06,以检查是否可以解决您的问题.

Try to update your gradle plugin to 3.3.0-alpha06 to check if that fixes your issue.

更新1:

现在,非Acii字符问题已在AAPT2和android gradle插件中得到修复(是!).现在,您可以只使用android gradle插件版本3.2.0-alpha11或更高版本,而不是禁用AAPT2,并且您再也不会遇到此错误.

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.

原始答案

当您使用Gradle 3.0的android插件时,默认情况下会启用Aapt2.

Aapt2 is enabled by default when you use android plugin for gradle 3.0.

这是

此处所述.

但是,如果您遇到问题,可以通过在gradle.properties

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错误:查看日志以了解详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-29 10:29