def safeExtGet(prop, fallback) { rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback } buildscript { if (project == rootProject) { repositories { google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:4.1.2' } } } 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( '