chore(android/gradle): update namespace handler

This commit is contained in:
KrzysztofMoch 2023-09-25 12:08:11 +02:00
parent 01a47840be
commit 4ad210b6c7
2 changed files with 26 additions and 6 deletions

View File

@ -24,11 +24,20 @@ def getExtOrDefault(name, defaultValue) {
} }
def isNewArchitectureEnabled() { def isNewArchitectureEnabled() {
// To opt-in for the New Architecture, you can either: return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
// - Set `newArchEnabled` to true inside the `gradle.properties` file }
// - Invoke gradle with `-newArchEnabled=true`
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true` def supportsNamespace() {
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true" 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 useExoplayerIMA = safeExtGet("RNVUseExoplayerIMA", false) def useExoplayerIMA = safeExtGet("RNVUseExoplayerIMA", false)
@ -48,7 +57,16 @@ if (isNewArchitectureEnabled()) {
} }
android { android {
if (supportsNamespace()) {
namespace 'com.brentvatne.react' namespace 'com.brentvatne.react'
sourceSets {
main {
manifest.srcFile "src/main/AndroidManifestNew.xml"
}
}
}
compileSdkVersion safeExtGet('compileSdkVersion', 31) compileSdkVersion safeExtGet('compileSdkVersion', 31)
buildToolsVersion safeExtGet('buildToolsVersion', '30.0.2') buildToolsVersion safeExtGet('buildToolsVersion', '30.0.2')

View File

@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>