Skip to content

proguard-android.txt breaks builds on AGP 9 — switch to proguard-android-optimize.txt #211

Description

@kinggolf

Describe the bug
Using proguard-android.txt in android/build.gradle breaks builds on AGP 9

To Reproduce
Upgrade project to Android Plugin Gradle 9 - in android/build.grade:

classpath 'com.android.tools.build:gradle:9.1.1'

Then build Android project.

Expected behavior
Expect project to build and run normally.

Actual behavior

A problem occurred evaluating project ':app'.
> `getDefaultProguardFile('proguard-android.txt')` is no longer supported since it includes `-dontoptimize`, which prevents R8 from performing many optimizations. Instead use `getDefaultProguardFile('proguard-android-optimize.txt)`, and if needed, temporarily use `-dontoptimize` in a custom keep rule file while fixing breakages.

Additional context
See Android Docs

Fix in android/build.gradle

-            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions