diff --git a/android/build.gradle b/android/build.gradle index 03bab08b..1635531e 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -30,6 +30,19 @@ repositories { apply plugin: 'com.android.library' +def supportsNamespace() { + def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.') + def major = parsed[0].toInteger() + def minor = parsed[1].toInteger() + + // Namespace support was added in 7.3.0 + if (major == 7 && minor >= 3) { + return true + } + + return major >= 8 +} + def resolveReactNativeDirectory() { def reactNativeLocation = safeExtGet("REACT_NATIVE_NODE_MODULES_DIR", null) if (reactNativeLocation != null) { @@ -80,9 +93,13 @@ if (isNewArchitectureEnabled()) { } android { - def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION - if (agpVersion.tokenize('.')[0].toInteger() >= 7) { + if (supportsNamespace()) { namespace "org.wonday.pdf" + sourceSets { + main { + manifest.srcFile "src/main/AndroidManifestNew.xml" + } + } } compileSdkVersion safeExtGet('compileSdkVersion', 31) diff --git a/android/src/main/AndroidManifestNew.xml b/android/src/main/AndroidManifestNew.xml new file mode 100644 index 00000000..2a14e6b6 --- /dev/null +++ b/android/src/main/AndroidManifestNew.xml @@ -0,0 +1,4 @@ + + + +