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 338bf34 commit fafcd70
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 @@ -21,7 +21,31 @@ 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.rnbootsplashw\""
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 {
if(shouldUseNameSpace){
namespace = "com.zoontek.rnbootsplash"
}
compileSdkVersion safeExtGet("compileSdkVersion", 33)
buildToolsVersion safeExtGet("buildToolsVersion", "33.0.0")
defaultConfig {
Expand Down

0 comments on commit fafcd70

Please sign in to comment.