You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nowinandroid/R8_Configuration_Analyzer_s...

1.1 KiB

R8 Configuration Analyzer Guide

Custom R8 Version Setup

To force the Android Gradle Plugin to use a custom version of R8 (like 9.3.+), you need to update your settings.gradle.kts file.

Add the following buildscript block at the very top inside pluginManagement inside settings.gradle

pluginManagement {
    buildscript {
        repositories {
            mavenCentral()
            maven {
                url = uri("https://storage.googleapis.com/r8-releases/raw")
            }
        }
        dependencies {
            classpath("com.android.tools:r8:9.3.7-dev")
        }
    }
    // ... rest of your pluginManagement block
}

Generating the R8 Keep Rule Analyzer Report

To generate the R8 Keep Rule dump, you need to execute a minified build and pass the dumpkeepradiushtmltodirectory flag to the JVM arguments running the R8 compiler.

Run the following command in your terminal:

./gradlew clean assembleBenchmark --no-build-cache -Dcom.android.tools.r8.dumpkeepradiushtmltodirectory=/tmp/r8analysis

After the build succeeds, the HTML tree report will be available in the /tmp/r8analysis directory.