Skip to content

Commit

Permalink
feat(android): 🌟 add support for React Native 0.73
Browse files Browse the repository at this point in the history
  • Loading branch information
ngocle2497 committed Jun 21, 2023
1 parent 831b98d commit 7973820
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,27 @@ if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
}

def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
def shouldUseNameSpace = agpVersion >= 7
def PACKAGE_PROP = "package=\"com.zoontek.rnpermissions\""
def manifestOutFile = file("${projectDir}/src/main/AndroidManifest.xml")
def manifestContent = manifestOutFile.getText()
if(shouldUseNameSpace){
manifestContent = manifestContent.replaceAll(
PACKAGE_PROP,
''
)
} else {
if(!manifestContent.contains("$PACKAGE_PROP")){
manifestContent = manifestContent.replace(
'<manifest',
"<manifest $PACKAGE_PROP "
)
}
}
manifestContent.replaceAll(" ", " ")
manifestOutFile.write(manifestContent)

android {
// Used to override the NDK path/version on internal CI or by allowing
// users to customize the NDK path/version from their root project (e.g. for M1 support)
Expand All @@ -67,6 +88,9 @@ android {
if (rootProject.hasProperty("ndkVersion")) {
ndkVersion rootProject.ext.ndkVersion
}
if (shouldUseNameSpace){
namespace = "com.zoontek.rnpermissions"
}

compileSdkVersion safeExtGet("compileSdkVersion", 33)
buildToolsVersion safeExtGet("buildToolsVersion", "33.0.0")
Expand Down

0 comments on commit 7973820

Please sign in to comment.