Skip to content

Commit 104eda2

Browse files
authored
fix(android): fix namespace build error on rn 0.66 (#3309)
1 parent 90f90d2 commit 104eda2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ _See [iOS](ios/install.md) & [Android](android/install.md) setup guide for using
7474

7575
- [node](https://nodejs.org)
7676
- [npm](https://www.npmjs.com/)
77-
- [React Native](https://facebook.github.io/react-native/) (0.64+)
77+
- [React Native](https://facebook.github.io/react-native/) (0.70+, older versions from 0.64+ might or might not work)
7878

7979

8080
## Installation

android/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ if (safeExtGet("RNMapboxMapsImpl", defaultMapboxMapsImpl) == "mapbox") {
4343
}
4444

4545
android {
46-
namespace = "com.rnmapbox.rnmbx"
46+
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
47+
// Check AGP version for backward compatibility reasons
48+
if (agpVersion.tokenize('.')[0].toInteger() >= 7) {
49+
namespace = "com.rnmapbox.rnmbx"
50+
}
4751
if (safeExtGet("RNMapboxMapsImpl", defaultMapboxMapsImpl) == "maplibre") {
4852
msg = '@rnmapbox/maps: Maplibre implementation has been removed, set RNMapboxMapsImpl to mapbox- see https://github.com/rnmapbox/maps/wiki/Deprecated-RNMapboxImpl-Maplibre#android'
4953
logger.error(msg)

0 commit comments

Comments
 (0)