Merge pull request #3255 from TheWidlarzGroup/chore/update-namespace-handler

chore(android): fix react native 0.73 support
This commit is contained in:
Olivier Bouillet 2023-09-27 21:47:06 +02:00 committed by GitHub
commit 9f938682a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 14 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,13 +57,29 @@ if (isNewArchitectureEnabled()) {
} }
android { android {
namespace 'com.brentvatne.react' if (supportsNamespace()) {
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')
compileOptions { def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
targetCompatibility JavaVersion.VERSION_1_8 if (agpVersion.tokenize('.')[0].toInteger() < 8) {
sourceCompatibility JavaVersion.VERSION_1_8 compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.majorVersion
}
} }
defaultConfig { defaultConfig {
@ -69,13 +94,12 @@ android {
} }
} }
packagingOptions { buildFeatures {
exclude "**/libreact_render*.so" buildConfig true
} }
compileOptions { packagingOptions {
sourceCompatibility JavaVersion.VERSION_1_8 exclude "**/libreact_render*.so"
targetCompatibility JavaVersion.VERSION_1_8
} }
buildDir 'buildOutput_' + configStringPath buildDir 'buildOutput_' + configStringPath

View File

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