Index of every page on this site: llms.txt
All skills
android avatar

/r8-analyzer

@7f7b217
by androidandroid/skills11k stars
703
Run it yourself

Analyzes Android build files and R8 keep rules to identify redundancies, broad package-wide rules, and rules that subsume library consumer keep rules. Use this skill when developers want to optimize their Android app's size, remove redundant or overly broad keep rules, or troubleshoot ProGuard configurations. Don't use for general Gradle build errors, Compose UI performance, or runtime CPU profiling.

Use this Skill: https://skilld.dev/gh/android/skills/r8-analyzer

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesCONFIGURATION.md

≈567 tokens on demand. Your agent reads this file only when SKILL.md points to it.

To achieve maximum utilization of R8, the codebase must be configured correctly depending on the build script language (Kotlin DSL versus Groovy DSL).

1. App modules (com.android.application)

The app's build.gradle or build.gradle.kts file must enable minification and resource shrinking within the release build type or the app's custom build type for release and performance testing. It must use the optimized default file (proguard-android-optimize.txt).

On AGP 9.3 and higher , the optimization { enable = true } DSL block turns on code shrinking (R8), resource shrinking, and proguard-android-optimize.txt in a single setting. When optimization { enable = true } is present in the release build type, all three checks are satisfied---do not report minification, resource shrinking, or proguard-android-optimize.txt as missing, and do not recommend switching back to isMinifyEnabled or isShrinkResources.

Kotlin DSL --- AGP 9.3 and higher (build.gradle.kts):

buildTypes {
   release {
       optimization {
           enable = true
       }
       proguardFiles("proguard-rules.pro")
   }
}

Kotlin DSL --- Legacy or Pre-AGP 9.3 (build.gradle.kts):

buildTypes {
   release {
       isMinifyEnabled = true
       isShrinkResources = true
       proguardFiles(
           getDefaultProguardFile("proguard-android-optimize.txt"),
           "proguard-rules.pro"
       )
   }
}

Groovy DSL (build.gradle):

buildTypes {
   release {
       minifyEnabled = true
       shrinkResources = true
       proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
   }
}

2. gradle.properties flags

Full mode: R8 full mode enables all optimizations.

  • AGP 8.0 and higher : Enabled by default. Verify that android.enableR8.fullMode=false is not present in gradle.properties.
  • Pre-AGP 8.0 : Verify that android.enableR8.fullMode=true is set in gradle.properties.

Optimized resource shrinking : If AGP is 8.12 or 8.13, verify that android.r8.optimizedResourceShrinking=true is set in gradle.properties. From AGP 9.0 it's on by default.

android.r8.optimizedResourceShrinking=true

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning7d4 checks · Risk SAFE
  • Gen Agent Trust Hub8d

    This skill analyzes Android build configurations and R8 keep rules to provide optimization recommendations. It uses standard Android development tools and Python scripts. No security issues were detected.

  • Socket7d

    No alerts

  • Snyk8d

    Risk: MEDIUM · 1 issue

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 7f7b217. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 1 hour ago.

Activeupdated last week
Other metadata
metadata
{
  "author": "Google LLC",
  "last-updated": "2026-11-11",
  "keywords": [
    "R8",
    "proguard",
    "keep rules",
    "app size",
    "optimization",
    "shrinking",
    "minification",
    "obfuscation"
  ]
}

README badge

README badge for android/skills/r8-analyzer