Aapt2Exception:Android 资源编译失败

这里的错误是什么,我该如何解决?我尝试重建我的代码,但它不起作用。


org.gradle.internal.UncheckedException: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed

Output:  C:\Users\dasorto\AndroidStudioProjects\ENews3\app\src\main\res\layout-enm-small\activity_second.xml:2: error: not well-formed (invalid token).


Command: C:\Users\dasorto\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\fcf510a17b6427e22ff6873eb8551d38\aapt2-3.2.0-4818971-windows\aapt2.exe compile --legacy \

        -o \

        C:\Users\dasorto\AndroidStudioProjects\ENews3\app\build\intermediates\res\merged\debug \

        C:\Users\dasorto\AndroidStudioProjects\ENews3\app\src\main\res\layout-enm-small\activity_second.xml

Daemon:  AAPT2 aapt2-3.2.0-4818971-windows Daemon #4

    at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:63)

    at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40)

    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:76)

    at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)

    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)

    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)

    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124)

    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)


弑天下
浏览 420回答 2
2回答

SMILET

该文件C:\Users\dasorto\AndroidStudioProjects\ENews3\app\src\main\res\layout-enm-small\activity_second.xml格式不正确,这意味着不是格式正确的 XML 文件。很可能它缺少一些结束标签(例如,您打开 a<style>并忘记用 a 关闭它</style>)。检查该文件是否有任何未关闭的标签,你应该没问题。

偶然的你

检查您的布局文件activity_second.xmlline&nbsp;2,有错误。只需遵循此错误行:`C:\Users\dasorto\AndroidStudioProjects\ENews3\app\src\main\res\layout-enm-small\activity_second.xml:2:&nbsp;error:&nbsp;not&nbsp;well-formed&nbsp;(invalid&nbsp;token)`你会发现这个问题。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java