Use side-by-side NDK for Android (#32848)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
Nicola Corti
2022-01-11 10:00:54 -08:00
committed by Facebook GitHub Bot
parent 0fccbd53af
commit bd7caa64f5
5 changed files with 10 additions and 20 deletions
-2
View File
@@ -648,7 +648,6 @@ jobs:
- ANDROID_BUILD_VERSION: 31
- ANDROID_TOOLS_VERSION: 31.0.0
- GRADLE_OPTS: -Dorg.gradle.daemon=false
- NDK_VERSION: 21.4.7075529
steps:
- checkout
@@ -694,7 +693,6 @@ jobs:
sdkmanager "build-tools;%ANDROID_TOOLS_VERSION%"
sdkmanager "add-ons;addon-google_apis-google-23"
sdkmanager "extras;android;m2repository"
sdkmanager "ndk;%NDK_VERSION%"
# -------------------------
# Run Tests
+5 -5
View File
@@ -274,11 +274,11 @@ task installArchives {
android {
compileSdkVersion 31
if (project.hasProperty("ANDROID_NDK_VERSION")) {
ndkVersion project.property("ANDROID_NDK_VERSION")
}
if (project.hasProperty("ANDROID_NDK_PATH")) {
ndkPath project.property("ANDROID_NDK_PATH")
// 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")
}
defaultConfig {
-7
View File
@@ -39,13 +39,6 @@ allprojects {
}
}
}
// used to override ndk path/version from env variables on CI
ext["ANDROID_NDK_PATH"] = null
if (System.getenv("LOCAL_ANDROID_NDK_VERSION") != null) {
setProperty("ANDROID_NDK_VERSION", System.getenv("LOCAL_ANDROID_NDK_VERSION"))
ext["ANDROID_NDK_PATH"] = System.getenv("ANDROID_NDK")
}
}
tasks.register("cleanAll", Delete::class.java) {
-1
View File
@@ -4,7 +4,6 @@ org.gradle.daemon=true
org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
ANDROID_NDK_VERSION=21.4.7075529
android.useAndroidX=true
kotlin_version=1.5.31
+5 -5
View File
@@ -143,11 +143,11 @@ def reactNativeArchitectures() {
android {
compileSdkVersion 31
if (project.hasProperty("ANDROID_NDK_VERSION")) {
ndkVersion project.property("ANDROID_NDK_VERSION")
}
if (project.hasProperty("ANDROID_NDK_PATH")) {
ndkPath project.property("ANDROID_NDK_PATH")
// 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")
}
flavorDimensions "vm"