Skip to content

Commit

Permalink
Use side-by-side NDK for Android (#32848)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cortinico authored and facebook-github-bot committed Jan 11, 2022
1 parent 0fccbd5 commit bd7caa6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 20 deletions.
2 changes: 0 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions ReactAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 0 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions packages/rn-tester/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit bd7caa6

Please sign in to comment.