← All tools

Tools · ProGuard / R8

ProGuard / R8 rules

Tick the libraries your app uses and get a ready proguard-rules.pro, with a note on every rule. Fixes the classic works-in-debug, crashes-in-release bugs.

Quick start:
Your app
Networking & JSON
Android & Jetpack
Firebase & Google
Images & media
Flutter
Fix "Missing class" build errors

Paste the R8 error from your release build (or the contents of build/outputs/mapping/release/missing_rules.txt). The matching -dontwarn lines are added to the file.

proguard-rules.pro⬇ Download
# proguard-rules.pro
# Generated by Hang Daro's ProGuard / R8 Rules Generator.
# Libraries not listed here ship their own rules.

# ---- JSON model classes (data classes for API responses) ----
-keep class com.example.app.data.model.** { *; }

# ---- Readable crash reports (line numbers) ----
-keepattributes SourceFile,LineNumberTable
-renamesourcefileattribute SourceFile
Turn on R8 in app/build.gradle
android {
    buildTypes {
        release {
            isMinifyEnabled = true
            isShrinkResources = true
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
}
Testing tips
  • Always test a release build on a real phone before uploading: install it with flutter build apk --release or ./gradlew assembleRelease.
  • If something breaks only in release, check the R8 output in build/outputs/mapping/release/: usage.txt lists removed code, mapping.txt maps renamed names.
  • Keep mapping.txt for every release (Play Console stores it for AABs) so crash reports can be decoded.