|
diff --git a/android/build.gradle b/android/build.gradle |
|
index 8a1d68f9..665991e2 100644 |
|
--- a/android/build.gradle |
|
+++ b/android/build.gradle |
|
@@ -1,3 +1,5 @@ |
|
+import org.apache.tools.ant.taskdefs.condition.Os |
|
+ |
|
// Top-level build file where you can add configuration options common to all sub-projects/modules. |
|
|
|
buildscript { |
|
@@ -6,7 +8,17 @@ buildscript { |
|
minSdkVersion = 21 |
|
compileSdkVersion = 31 |
|
targetSdkVersion = 31 |
|
- ndkVersion = "21.4.7075529" |
|
+ if (System.properties['os.arch'] == "aarch64") { |
|
+ // For M1 Users we need to use the NDK 24 which added support for aarch64 |
|
+ ndkVersion = "24.0.8215888" |
|
+ } else if (Os.isFamily(Os.FAMILY_WINDOWS)) { |
|
+ // For Android Users, we need to use NDK 23, otherwise the build will |
|
+ // fail due to paths longer than the OS limit |
|
+ ndkVersion = "23.1.7779620" |
|
+ } else { |
|
+ // Otherwise we default to the side-by-side NDK version from AGP. |
|
+ ndkVersion = "21.4.7075529" |
|
+ } |
|
} |
|
repositories { |
|
google() |
|
diff --git a/node_modules/react-native/ReactAndroid/build.gradle b/node_modules/react-native/ReactAndroid/build.gradle |
|
index 5a384f23..a77e8545 100644 |
|
--- a/node_modules/react-native/ReactAndroid/build.gradle |
|
+++ b/node_modules/react-native/ReactAndroid/build.gradle |
|
@@ -281,10 +281,13 @@ task androidSourcesJar(type: Jar) { |
|
android { |
|
compileSdkVersion 31 |
|
|
|
- // Used to override the NDK path & version on internal CI |
|
- if (System.getenv("ANDROID_NDK") != null && System.getenv("LOCAL_ANDROID_NDK_VERSION") != null) { |
|
- ndkPath System.getenv("ANDROID_NDK") |
|
- ndkVersion System.getenv("LOCAL_ANDROID_NDK_VERSION") |
|
+ // Used to override the NDK path/version on internal CI or by allowing |
|
+ // users to customize the NDK path/version from their root project (e.g. for M1 support) |
|
+ if (rootProject.hasProperty("ndkPath")) { |
|
+ ndkPath rootProject.ext.ndkPath |
|
+ } |
|
+ if (rootProject.hasProperty("ndkVersion")) { |
|
+ ndkVersion rootProject.ext.ndkVersion |
|
} |
|
|
|
defaultConfig { |
Your gradle commands and cd commands are unix-y, and do not work in powershell because of
/' vs '\' and
./gradlew` vs 'gradlew.bat' because....windows