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( + ' +