From 2e4851eae72913cb1ed543df58a929a9e5ec115f Mon Sep 17 00:00:00 2001 From: Arjan Zuidema Date: Mon, 26 Jun 2023 11:26:44 +0200 Subject: [PATCH] feat(android): Add support for upcoming React Native 0.73 (#505) --- android/build.gradle | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/android/build.gradle b/android/build.gradle index 3f76132..3325454 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -113,7 +113,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.reactnativecommunity.cameraroll\"" +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( + '