Skip to content

Commit bd7caa6

Browse files
cortinicofacebook-github-bot
authored andcommitted
Use side-by-side NDK for Android (#32848)
Summary: Pull Request resolved: #32848 If we leverage the side-by-side configuration of the NDK (see https://developer.android.com/studio/projects/configure-agp-ndk#agp_version_41) we will not have to specify the NDK Path or Version at all. We will automatically pick the best NDK version selected by AGP. Changelog: [Android] [Changed] - Use side-by-side NDK for Android Reviewed By: ShikaSD Differential Revision: D33475818 fbshipit-source-id: 16aa4acfc44b94e2f92df89d71e104bf46d7f162
1 parent 0fccbd5 commit bd7caa6

File tree

5 files changed

+10
-20
lines changed

5 files changed

+10
-20
lines changed

.circleci/config.yml

-2
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,6 @@ jobs:
648648
- ANDROID_BUILD_VERSION: 31
649649
- ANDROID_TOOLS_VERSION: 31.0.0
650650
- GRADLE_OPTS: -Dorg.gradle.daemon=false
651-
- NDK_VERSION: 21.4.7075529
652651
steps:
653652
- checkout
654653

@@ -694,7 +693,6 @@ jobs:
694693
sdkmanager "build-tools;%ANDROID_TOOLS_VERSION%"
695694
sdkmanager "add-ons;addon-google_apis-google-23"
696695
sdkmanager "extras;android;m2repository"
697-
sdkmanager "ndk;%NDK_VERSION%"
698696
699697
# -------------------------
700698
# Run Tests

ReactAndroid/build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,11 @@ task installArchives {
274274

275275
android {
276276
compileSdkVersion 31
277-
if (project.hasProperty("ANDROID_NDK_VERSION")) {
278-
ndkVersion project.property("ANDROID_NDK_VERSION")
279-
}
280-
if (project.hasProperty("ANDROID_NDK_PATH")) {
281-
ndkPath project.property("ANDROID_NDK_PATH")
277+
278+
// Used to override the NDK path & version on internal CI
279+
if (System.getenv("ANDROID_NDK") != null && System.getenv("LOCAL_ANDROID_NDK_VERSION") != null) {
280+
ndkPath System.getenv("ANDROID_NDK")
281+
ndkVersion System.getenv("LOCAL_ANDROID_NDK_VERSION")
282282
}
283283

284284
defaultConfig {

build.gradle.kts

-7
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@ allprojects {
3939
}
4040
}
4141
}
42-
43-
// used to override ndk path/version from env variables on CI
44-
ext["ANDROID_NDK_PATH"] = null
45-
if (System.getenv("LOCAL_ANDROID_NDK_VERSION") != null) {
46-
setProperty("ANDROID_NDK_VERSION", System.getenv("LOCAL_ANDROID_NDK_VERSION"))
47-
ext["ANDROID_NDK_PATH"] = System.getenv("ANDROID_NDK")
48-
}
4942
}
5043

5144
tasks.register("cleanAll", Delete::class.java) {

gradle.properties

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ org.gradle.daemon=true
44
org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
55
org.gradle.parallel=true
66

7-
ANDROID_NDK_VERSION=21.4.7075529
87
android.useAndroidX=true
98
kotlin_version=1.5.31
109

packages/rn-tester/android/app/build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ def reactNativeArchitectures() {
143143

144144
android {
145145
compileSdkVersion 31
146-
if (project.hasProperty("ANDROID_NDK_VERSION")) {
147-
ndkVersion project.property("ANDROID_NDK_VERSION")
148-
}
149-
if (project.hasProperty("ANDROID_NDK_PATH")) {
150-
ndkPath project.property("ANDROID_NDK_PATH")
146+
147+
// Used to override the NDK path & version on internal CI
148+
if (System.getenv("ANDROID_NDK") != null && System.getenv("LOCAL_ANDROID_NDK_VERSION") != null) {
149+
ndkPath System.getenv("ANDROID_NDK")
150+
ndkVersion System.getenv("LOCAL_ANDROID_NDK_VERSION")
151151
}
152152

153153
flavorDimensions "vm"

0 commit comments

Comments
 (0)