Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Release build fails on a ProGuard file that does not exist or proguard-android.txt

Errorproguard-project.txt not found

Short answer

From AGP 9.0 the build fails when a keep file listed in proguardFiles is not on disk, and getDefaultProguardFile only accepts proguard-android-optimize.txt. Remove or correct the broken entry, and switch the default file name. If you really need optimization off, put the flag in your own file.

  • Applies to Android Gradle Plugin 9.0, Gradle 9.1, JDK 17
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Print the keep files your release build type lists and check each one exists in the module folder.

    grep -n "proguardFiles\|getDefaultProguardFile" app/build.gradle*
    ls app/*.pro app/*.txt
  2. 2Match what you see, then jump to its fix

    1. 1the build breaks on a name in proguardFiles that no file in the module matches, for example a typo or a leftover proguard-project.txtA listed keep file is not on disk (AGP 9 fails on it)Fix
    2. 2the build still names getDefaultProguardFile with proguard-android.txtproguard-android.txt is no longer a supported default fileFix

What does the error look like?

  • proguard-project.txt not found
  • a proguardFiles entry points at a file that is not in the module
  • getDefaultProguardFile("proguard-android.txt") rejected after upgrading to AGP 9

Cause 1 of 2

A listed keep file is not on disk (AGP 9 fails on it)

1Check

AGP 9.0 turned on android.proguard.failOnMissingFiles by default. Before that, a misspelled keep file name was silently ignored.

grep -rn "failOnMissingFiles" gradle.properties app/build.gradle* ; ls app

2Fix

Delete the entry, or fix the name so it points at a real file.

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

3Verify

Build the release variant again.

./gradlew :app:assembleRelease

Confirmed by developer.android.com

Did this fix it?

Cause 2 of 2

proguard-android.txt is no longer a supported default file

1Check

Search the project for the old file name. AGP 9.0 supports only proguard-android-optimize.txt there, because the old file contains -dontoptimize.

grep -rn "proguard-android.txt" --include=*.gradle --include=*.kts .

2Fix

Switch to the optimize variant. If you must keep optimization off, add the flag to your own rules file instead of relying on the default file.

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

# proguard-rules.pro, only if optimization must stay off
-dontoptimize

3Verify

The release build runs R8 without complaining about the default file.

./gradlew :app:assembleRelease

Confirmed by developer.android.com

Did this fix it?

How do I stop it coming back?

  • Name each file in proguardFiles exactly as it is on disk.
  • Use the Android Gradle plugin upgrade assistant, which preserves old behavior where it can, then clean up one default at a time.
  • Build the release variant in CI after every plugin upgrade.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

Android Studio cannot pair the phone over Wi-Fi

The Pair devices over Wi-Fi dialog lists no device

Wireless pairing needs the phone on Android 11 or higher and on the same Wi-Fi network as the computer, with current Platform-Tools.

4 causes, each with a fix

Mobile apps

adb tcpip 5555 fails because no device is found

adb: more than one device/emulator

adb tcpip only works while the device is attached and listed by adb, because it tells the phone to start listening on port 5555.

4 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.