R8: Missing class
Error text
ERROR: R8: Missing class com.example.Foo (referenced from: void com.example.Bar.run()) Missing classes detected while running R8. Please add the missing classes or apply additional keep rules.
Cause
While shrinking, R8 sees a reference to a class that is not there. It happens in release builds when a library's rules are missing.
Step-by-step fix
- Open
build/outputs/mapping/release/missing_rules.txt. R8 writes the missing rules there. - Copy those lines into
proguard-rules.pro. - If the class is truly unused, write
-dontwarn. If it is needed, write-keep. - Check whether the library ships its own
consumer-rules, and update its version. - Rebuild with
./gradlew assembleReleaseand open the app on a phone.
Example commands
# app/build/outputs/mapping/release/missing_rules.txt faylına bax
# proguard-rules.pro
-keep class com.example.Foo { *; }
-dontwarn com.example.Foo
./gradlew assembleReleaseHow to prevent it
Build release once after adding each library so the error does not show up late.
Author and license: Nibras Code
- APK will not install
- What is a parse error?
- The keystore is lost
- The signatures do not match
- Package name error
- The APK file is damaged
- Play Protect blocks the app
- The package appears to be invalid
- Not enough storage
- The phone is not compatible
- An older version will not install
- XAPK will not install
- Gradle sync failed
- Could not resolve a dependency
- Duplicate class error
- Manifest merger failed
- Dex limit: 65536 methods
- JDK version mismatch
- SDK location not found
- minSdkVersion conflict
- compileSdk is too low
- EAS build: Gradle failure
- expo prebuild error
- Metro: Unable to resolve module
- Hermes: JS error only in release
- White screen in release
- Red screen: cannot reach Metro
- Expo SDK mismatch
- Capacitor sync error
- Capacitor: white screen
- EAS: keystore and credentials error
- Keystore was tampered with / wrong password
- Wrong key alias or password
- Play: signed with the wrong key
- INSTALL_FAILED_UPDATE_INCOMPATIBLE
- INSTALL_FAILED_VERSION_DOWNGRADE
- INSTALL_FAILED_INSUFFICIENT_STORAGE
- INSTALL_FAILED_NO_MATCHING_ABIS
- Parse error (problem parsing the package)
- "App not installed" error
- Installing an AAB file on a phone
- adb: device "unauthorized"
- adb: device not found
- adb server version mismatch
- Activity class does not exist
- Play: targetSdk level too low
- Play: permissions policy rejection
- Play: 64-bit requirement
- Play: versionCode already used
- ClassNotFound / NoSuchMethod crash
- OutOfMemoryError crash
- CLEARTEXT communication not permitted
- SecurityException: permission denied