Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in
Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in


The error message you’re encountering is related to R8, which is the code shrinker and obfuscator used by Android Studio. It indicates that there are missing classes, and you need to either add those classes explicitly or apply additional keep rules.

Here are some steps you can take to fix this issue:

  1. Check the missing_rules.txt file: Open the missing_rules.txt file located at C:\Users\PC\AndroidStudioProjects\YourApp\app\build\outputs\mapping\release\missing_rules.txt. This file usually contains suggestions for keep rules that you can add to your Proguard (or R8) configuration to prevent certain classes or methods from being removed or obfuscated.
  2. Add Keep Rules: Copy the keep rules from missing_rules.txt and add them to your Proguard or R8 configuration file. You can find the Proguard or R8 configuration file in your app module’s proguard-rules.pro file or in the build.gradle file. Look for the proguardFiles or consumerProguardFiles section.For example, in your proguard-rules.pro file: code-keep class com.example.YourClass { *; }
  3. Rebuild Your Project: After adding the keep rules, rebuild your project to apply the changes.
  4. Review Dependencies: Check your project’s dependencies and make sure that you are using versions that are compatible with each other. Incompatibility between library versions can sometimes lead to missing class issues.
  5. Update Gradle and Dependencies: Ensure that you are using the latest version of Gradle and Android Gradle Plugin. Also, update your dependencies to the latest versions to ensure compatibility.In your build.gradle file (Project-level): codeclasspath 'com.android.tools.build:gradle:latest_version' In your build.gradle file (Module-level): implementation 'com.example:your-library:latest_version'
  6. Check for Library-Specific Configuration: Some libraries might require specific Proguard or R8 rules. Check the documentation of the libraries you are using and make sure to include any required configuration in your Proguard or R8 file.
  7. Debugging: If the issue persists, you may need to debug the problem further. Look into the specific classes that are reported as missing and investigate why they are being removed by the code shrinker.

Remember to backup your project before making significant changes to the Proguard or R8 configuration, as incorrect configurations can lead to runtime issues.

Leave a Reply

Your email address will not be published. Required fields are marked *