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