Release build fails on a ProGuard file that does not exist or proguard-android.txt
proguard-project.txt not foundShort 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.
Fix it fast
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/*.txt2Match what you see, then jump to its fix
- 1
the 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
the build still names getDefaultProguardFile with proguard-android.txtproguard-android.txt is no longer a supported default fileFix
- 1
What does the error look like?
proguard-project.txt not founda proguardFiles entry points at a file that is not in the modulegetDefaultProguardFile("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 app2Fix
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:assembleReleaseConfirmed by developer.android.com
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
-dontoptimize3Verify
The release build runs R8 without complaining about the default file.
./gradlew :app:assembleReleaseConfirmed by developer.android.com
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
adb cannot start because something already holds its port
adb start-server failed
The adb server must bind local TCP port 5037, and every adb client talks to it there.
2 causes, each with a fixMobile apps
The phone shows as unauthorized and Android Studio will not run the app
adb devices lists the phone but Android Studio cannot deploy to it
An unauthorized phone means it has not trusted this computer's RSA key.
3 causes, each with a fixMobile 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 fixMobile apps
adb cannot connect to its daemon or start the server
* daemon started successfully *
The adb server is a background process on your computer that listens on TCP port 5037.
2 causes, each with a fixMobile apps
adb prints 'server version doesn't match this client; killing...'
adb server version doesn't match this client; killing...
adb runs a background server, and every adb command is a client.
3 causes, each with a fixMobile 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