android
build_error
ai_generated
true
Android resource linking failed. error: resource style/Theme.AppCompat not found
ID: android/aapt2-resource-linking-failed
85%Fix Rate
88%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 8 | active | — | — | — |
Root Cause
AAPT2 cannot link a referenced resource. Missing dependency, wrong theme parent, or resource name typo.
genericWorkarounds
-
92% success Add the missing AppCompat/Material dependency
implementation 'com.google.android.material:material:1.11.0' // provides Material themes and styles
-
88% success Verify the parent theme exists in your dependencies
Check styles.xml parent theme; ensure it matches an available theme from your dependencies
-
82% success Run AAPT2 with verbose logging to find exact missing resource
./gradlew assembleDebug --info 2>&1 | grep 'AAPT' # shows exact resource and file with the error
Dead Ends
Common approaches that don't work:
-
Disable AAPT2 (android.enableAapt2=false)
92% fail
AAPT2 is mandatory since AGP 3.0+. The flag is ignored in modern versions.
-
Copy missing resource definitions from library source code
78% fail
Library resources should come from the dependency. Duplicating them causes version conflicts.