From 4d9c3df4644c075dc081b21f39c7d67b4b74d0d1 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen <4123478+tido64@users.noreply.github.com> Date: Wed, 21 Feb 2024 10:09:53 -0800 Subject: [PATCH] fix(android): fix `ndkVersion` is unset when building from source (#43131) Summary: `ndkVersion` is unset when building from source using this guide: https://reactnative.dev/contributing/how-to-build-from-source ## Changelog: [ANDROID] [FIXED] - Fix `ndkVersion` is unset when building from source Pull Request resolved: https://github.com/facebook/react-native/pull/43131 Test Plan: ``` git clone https://github.com/microsoft/react-native-test-app.git cd react-native-test-app npm run set-react-version nightly yarn # Manually apply the patch in node_modules/react-native/ReactAndroid/build.gradle.kts # Enable building from source sed -i '' 's/#react.buildFromSource/react.buildFromSource/' example/android/gradle.properties # Build cd example/android ./gradlew assembleDebug ``` Reviewed By: christophpurrer Differential Revision: D54006425 Pulled By: cortinico fbshipit-source-id: 9ede64bc14af4cf609b7a4c12c5a1082bbc31f09 --- packages/react-native/ReactAndroid/build.gradle.kts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/react-native/ReactAndroid/build.gradle.kts b/packages/react-native/ReactAndroid/build.gradle.kts index 7c8499df4f58c2..c19351acaae072 100644 --- a/packages/react-native/ReactAndroid/build.gradle.kts +++ b/packages/react-native/ReactAndroid/build.gradle.kts @@ -488,6 +488,8 @@ android { } if (rootProject.hasProperty("ndkVersion") && rootProject.properties["ndkVersion"] != null) { ndkVersion = rootProject.properties["ndkVersion"].toString() + } else { + ndkVersion = libs.versions.ndkVersion.get() } compileOptions {