Search code examples
androidxmlandroid-studioaapt2

AAPT2 error: check logs for details in android studio


I'm just learning android studio and getting this error and am unable to resolve. I can't even get what the problem is related with. (all other applications are working properly).I tried some other solutions from stackoverflow but none resolves my issue....

Any explanations???

AGPBI: {"kind":"error","text":"error: not well-formed (invalid token).","sources":[{"file":"C:\Users\*************\AndroidStudioProjects\myapp\app\src\main\res\layout\activity_main.xml","position":{"startLine":25}}],"original":"","tool":"AAPT"}

error: not well-formed (invalid token). Message{kind=ERROR, text=error: not well-formed (invalid token)., sources=[C:\Users*************\AndroidStudioProjects\myapp\app\src\main\res\layout\activity_main.xml:26], original message=, tool name=Optional.of(AAPT)}

Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details


Solution

  • The error is telling you that your file activity_main.xml is not well-formed - that means it's probably missing a closing tag or similar, making it an invalid XML file.