Description:
Info:
• Plugin Version: 8.1.0
• Android Gradle Plugin (AGP) Version: 9.2.1
Describe the Bug
When building an Android project using Android Gradle Plugin 9.x, the build fails with an exception
evaluating :capacitor-community-fcm because of a call to getDefaultProguardFile('proguard-android.txt') .
Modern versions of AGP and the R8 compiler no longer support proguard-android.txt because it includes the -
dontoptimize flag, which prevents optimization. Instead, AGP requires libraries to use proguard-android-optimize.txt
Steps to Reproduce
- Configure an Android project with AGP 9.x .
- Add @capacitor-community/fcm .
- Run
gradlew assembleDebug or gradlew assembleRelease .
Error Log / Stack Trace
* Where:
Build file 'node_modules/@capacitor-community/fcm/android/build.gradle' line: 34
* What went wrong:
A problem occurred evaluating project ':capacitor-community-fcm'.
> `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.
Suggested Fix
Update the proguardFiles configuration in the plugin's android/build.gradle file to use proguard-android-
optimize.txt instead:
buildTypes {
release {
minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Description:
Info:
• Plugin Version: 8.1.0
• Android Gradle Plugin (AGP) Version: 9.2.1
Describe the Bug
When building an Android project using Android Gradle Plugin 9.x, the build fails with an exception
evaluating :capacitor-community-fcm because of a call to getDefaultProguardFile('proguard-android.txt') .
Modern versions of AGP and the R8 compiler no longer support proguard-android.txt because it includes the -
dontoptimize flag, which prevents optimization. Instead, AGP requires libraries to use proguard-android-optimize.txt
Steps to Reproduce
gradlew assembleDebugorgradlew assembleRelease.Error Log / Stack Trace
Suggested Fix
Update the proguardFiles configuration in the plugin's android/build.gradle file to use proguard-android-
optimize.txt instead:
buildTypes { release { minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } }