Android "AAPT2 error: check logs for details" in CI
By Kaveh Alemi·Latchkey
AAPT2, the Android asset packaging tool, failed but the top-level message hides the detail. The actual cause is a specific resource error in the full log.
What this error means
The build fails with AAPT2 error: check logs for details. Without more output it is opaque; the underlying error is a concrete resource or XML problem.
Mobile CI failures cluster into three: a missing or mismatched SDK component, a code-signing identity that does not exist on the runner, or a simulator or emulator that never became ready.
Terminal
# Android
sdkmanager --list_installed 2>/dev/null | head
echo "ANDROID_HOME=$ANDROID_HOME"
adb devices
# iOS
xcodebuild -version && xcrun simctl list devices available | head
security find-identity -v -p codesigning
Common causes
Malformed resource XML
An invalid color, unescaped character, or broken XML in a resource file makes AAPT2 fail.
Corrupt or unsupported asset
A bad PNG or unsupported file in res/ can crash resource compilation.
How to fix it
Surface the real error with --stacktrace
Re-run the failing task with --stacktrace and --info to print the full AAPT2 message.
Fix the file and line it names.
shell
./gradlew assembleDebug --stacktrace --info
Validate resources before building
Run lint and validate XML resources to catch malformed files in PR checks.
How to prevent it
Lint resources in CI and validate XML so AAPT2 surprises surface before the build. Keep assets in supported formats.
Frequently asked questions
What causes Android "AAPT2 error: check logs for details" in CI?
There are 2 common causes: malformed resource xml and corrupt or unsupported asset. An invalid color, unescaped character, or broken XML in a resource file makes AAPT2 fail.
How do I fix Android "AAPT2 error: check logs for details" in CI?
There are 2 fixes depending on which cause you have: surface the real error with --stacktrace and validate resources before building. Work through them in order, since the first is the most common.
What does Android "AAPT2 error: check logs for details" in CI actually mean?
The build fails with AAPT2 error: check logs for details.
How do I stop Android "AAPT2 error: check logs for details" in CI happening again?
Lint resources in CI and validate XML so AAPT2 surprises surface before the build.