Environment
- React Native: 0.87.0
- @rnmapbox/maps: 10.3.5
- Android Gradle Plugin: 9.0+
- Gradle: 9.4.1
Problem
Android builds fail during Gradle configuration because the library uses the legacy proguard-android.txt file:
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
Starting with AGP 9, getDefaultProguardFile() no longer supports proguard-android.txt.
Error
getDefaultProguardFile('proguard-android.txt') is no longer supported.
Instead, use getDefaultProguardFile('proguard-android-optimize.txt').
Workaround
Replacing:
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
with:
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
fixes the build.
Additional information
According to the AGP 9 release notes, proguard-android.txt is no longer supported because it contains the -dontoptimize flag, which disables many R8 optimizations.
Google now recommends using proguard-android-optimize.txt as the default configuration.
Environment
Problem
Android builds fail during Gradle configuration because the library uses the legacy
proguard-android.txtfile:Starting with AGP 9,
getDefaultProguardFile()no longer supportsproguard-android.txt.Error
Workaround
Replacing:
with:
fixes the build.
Additional information
According to the AGP 9 release notes,
proguard-android.txtis no longer supported because it contains the-dontoptimizeflag, which disables many R8 optimizations.Google now recommends using
proguard-android-optimize.txtas the default configuration.