R8: Missing class 🤖 Android

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

  1. Copy rules from missing_rules.txt into proguard-rules.pro
  2. Add the dependency if the code path is used
  3. Update the library

Detailed fix by platform

Shell

  1. cat app/build/outputs/mapping/release/missing_rules.txt >> app/proguard-rules.pro

How to diagnose

  1. Classes — Which ones are missing?
  2. 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:

🧠 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.