ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules (missing_rules.txt)
R8 (minification) found references to classes that aren’t on the classpath, typically optional dependencies of a library.
Seen on:
Android
Meaning
Since AGP 8, missing classes are errors. AGP writes suggested -dontwarn rules to build/outputs/mapping/release/missing_rules.txt — copy them into proguard-rules.pro if the referenced code paths aren’t used.
Common causes
- Library references optional dependencies (e.g. OkHttp → Conscrypt/BouncyCastle)
- Annotation-only classes (javax.annotation, errorprone)
- Missing actual dependency
⚡ Quick fix
- Copy rules from missing_rules.txt into proguard-rules.pro
- Add the dependency if the code path is used
- Update the library
Detailed fix by platform
Shell
cat app/build/outputs/mapping/release/missing_rules.txt >> app/proguard-rules.pro
How to diagnose
- Classes — Which ones are missing?
- Usage — Is that code path used at runtime?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Android resource linking failed AAPT: error: resource x (aka y) not found — Android resource linking failed
- android:attr/lStar not found AAPT: error: resource android:attr/lStar not found
- Cannot fit requested classes in a single dex file Cannot fit requested classes in a single dex file (# methods: 65536 > 65536) — mergeDex failed
Most viewed in Android
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026