From e53ffd7da5992f1d06686f730c4204bc80749a75 Mon Sep 17 00:00:00 2001 From: Mason Le <43195241+MasonLe2497@users.noreply.github.com> Date: Mon, 19 Jun 2023 18:12:43 +0700 Subject: [PATCH 1/3] =?UTF-8?q?feat(android):=20=F0=9F=8C=9F=20add=20suppo?= =?UTF-8?q?rt=20for=20React=20Native=200.73?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/build.gradle | 2 +- android/src/main/AndroidManifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index e424f12..515d164 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'com.android.library' android { compileSdkVersion safeExtGet('compileSdkVersion', 28) - + namespace = "org.reactnative.maskedview" defaultConfig { minSdkVersion safeExtGet('minSdkVersion', 16) targetSdkVersion safeExtGet('targetSdkVersion', 28) diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index 8e9ce44..a2f47b6 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1,2 +1,2 @@ - + From 15d8b358f03c493ab1992d766f86e8c297cbbf83 Mon Sep 17 00:00:00 2001 From: Mason Le <43195241+MasonLe2497@users.noreply.github.com> Date: Wed, 21 Jun 2023 10:46:29 +0700 Subject: [PATCH 2/3] feat(android): add support RN <0.71 and RN 0.73 --- android/build.gradle | 27 ++++++++++++++++++++++++++- android/src/main/AndroidManifest.xml | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 515d164..ed87f73 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -17,9 +17,34 @@ buildscript { apply plugin: 'com.android.library' +def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger() +def shouldUseNameSpace = agpVersion >= 7 +def PACKAGE_PROP = "package=\"org.reactnative.maskedview\"" +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( + ' + From cd6fb87ac1d3921e30b9d4869abbef1d6088478a Mon Sep 17 00:00:00 2001 From: Mason Le <43195241+MasonLe2497@users.noreply.github.com> Date: Fri, 6 Oct 2023 16:55:40 +0700 Subject: [PATCH 3/3] refactor(android): refactor build.gradle to switch use namespace --- android/build.gradle | 37 ++++++++++++------------- android/src/main/AndroidManifestNew.xml | 2 ++ 2 files changed, 19 insertions(+), 20 deletions(-) create mode 100644 android/src/main/AndroidManifestNew.xml diff --git a/android/build.gradle b/android/build.gradle index ed87f73..9166939 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -17,32 +17,29 @@ buildscript { apply plugin: 'com.android.library' -def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger() -def shouldUseNameSpace = agpVersion >= 7 -def PACKAGE_PROP = "package=\"org.reactnative.maskedview\"" -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( - '= 3) { + return true + } + + return major >= 8 } -manifestContent.replaceAll(" ", " ") -manifestOutFile.write(manifestContent) android { compileSdkVersion safeExtGet('compileSdkVersion', 28) - if(shouldUseNameSpace){ + if(supportsNamespace()){ namespace = "org.reactnative.maskedview" + sourceSets { + main { + manifest.srcFile "src/main/AndroidManifestNew.xml" + } + } } defaultConfig { diff --git a/android/src/main/AndroidManifestNew.xml b/android/src/main/AndroidManifestNew.xml new file mode 100644 index 0000000..c7e7078 --- /dev/null +++ b/android/src/main/AndroidManifestNew.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file