Skip to content

Commit

Permalink
Add support for RN 0.64+ (by excluding libturbomodulejsijni.so (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryantrem authored Jul 28, 2021
1 parent caa566c commit 3ce6a35
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Modules/@babylonjs/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
},
"peerDependencies": {
"@babylonjs/core": "^5.0.0-alpha.34",
"react": "^16.13.1",
"react-native": "^0.63.1",
"react": ">=16.13.1",
"react-native": ">=0.63.1",
"react-native-permissions": "^2.1.4"
},
"devDependencies": {
Expand Down
12 changes: 12 additions & 0 deletions Package/Android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

def reactProperties = new Properties()
file("$projectDir/../../../react-native/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
def REACT_VERSION = reactProperties.getProperty("VERSION_NAME").split("\\.")[1].toInteger()

apply plugin: 'com.android.library'
apply plugin: 'maven'

Expand Down Expand Up @@ -59,6 +63,14 @@ android {
}
}

// The full/real version of libturbomodulejsijni.so will be built and included in apps using React Native 0.64 or newer,
// so exclude Babylon React Native's minimal version of these libs in this case.
if (REACT_VERSION >= 64) {
android.packagingOptions.excludes += 'lib/armeabi-v7a/libturbomodulejsijni.so'
android.packagingOptions.excludes += 'lib/arm64-v8a/libturbomodulejsijni.so'
android.packagingOptions.excludes += 'lib/x86/libturbomodulejsijni.so'
}

repositories {
// ref: https://www.baeldung.com/maven-local-repository
mavenLocal()
Expand Down

0 comments on commit 3ce6a35

Please sign in to comment.