Skip to content

Commit 73d9f5a

Browse files
gradle fix
1 parent 171cced commit 73d9f5a

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

Modules/@babylonjs/react-native/android/build.gradle

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,6 @@
1010
// original location:
1111
// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle
1212

13-
buildscript {
14-
ext.safeExtGet = {prop, fallback ->
15-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
16-
}
17-
repositories {
18-
google()
19-
gradlePluginPortal()
20-
}
21-
dependencies {
22-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet("kotlinVersion", "1.8.0")}")
23-
classpath("com.android.tools.build:gradle:8.1.1")
24-
}
25-
}
26-
2713
def isNewArchitectureEnabled() {
2814
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
2915
}
@@ -41,7 +27,6 @@ def DEFAULT_MIN_SDK_VERSION = 21
4127
def DEFAULT_TARGET_SDK_VERSION = 30
4228
def DEFAULT_NDK_VERSION = '23.1.7779620'
4329

44-
4530
def safeExtGet(prop, fallback) {
4631
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
4732
}
@@ -62,6 +47,22 @@ def cpp_distribution = (REACT_VERSION >= 71) ? "c++_shared" : "c++_static";
6247
def BABYLON_NATIVE_PLUGIN_NATIVECAMERA = System.getenv("BABYLON_NATIVE_PLUGIN_NATIVECAMERA") != "0"
6348
def BABYLON_NATIVE_PLUGIN_NATIVEXR = System.getenv("BABYLON_NATIVE_PLUGIN_NATIVEXR") != "0"
6449

50+
buildscript {
51+
// The Android Gradle plugin is only required when opening the android folder stand-alone.
52+
// This avoids unnecessary downloads and potential conflicts when the library is included as a
53+
// module dependency in an application project.
54+
// ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies
55+
if (project == rootProject) {
56+
repositories {
57+
google()
58+
mavenCentral()
59+
}
60+
dependencies {
61+
classpath 'com.android.tools.build:gradle:7.2.2'
62+
}
63+
}
64+
}
65+
6566
def graphics_api = safeExtGet('GRAPHICS_API', "OpenGL")
6667

6768
apply plugin: 'com.android.library'
@@ -147,16 +148,13 @@ android {
147148
}
148149

149150
repositories {
150-
maven {
151-
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
152-
url("$rootDir/../node_modules/react-native/android")
153-
}
154-
mavenCentral()
155151
google()
152+
mavenCentral()
156153
}
157154

158155
dependencies {
159-
implementation ("com.facebook.react:react-android:+")
156+
//noinspection GradleDynamicVersion
157+
implementation 'com.facebook.react:react-native:+' // From node_modules
160158
implementation fileTree(dir: "libs", include: ["*.jar"])
161159
implementation 'com.google.ar:core:1.22.0'
162160
implementation 'com.facebook.fbjni:fbjni:0.3.0'

0 commit comments

Comments
 (0)