rnmapbox / rnmapbox/maps

Android build fails with AGP 9 because proguard-android.txt is no longer supported

Open Beginner friendly
#4,281 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug-setup 🪲
Dominant language
Kotlin
Stars
2.9k
Forks
947
Avg merge
6d 37m
Merged PRs (30d)
1

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the Android Gradle configuration for the proguardFiles declaration shown in the issue and inspect the surrounding release-build setup. Replace the unsupported legacy default with the recommended AGP 9 configuration, then verify that an Android build using AGP 9 and Gradle 9.4.1 completes without the configuration error.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin, react-native
Domain
build-system, mobile
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.