Skip to content

Commit 2c62dca

Browse files
cortinicotido64
andauthored
[0.74] Fixes build from source on Android (#43616)
* 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: #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 * Fix build from source for hermes-engine (#43609) Summary: Pull Request resolved: #43609 When users are building from source for React Native they don't have an ndkVersion variable specified. So we want to fallback to the global NDK version we set for the whole build here. Changelog: [Android] [Fixed] - Fix build from source for hermes-engine Reviewed By: dmytrorykun Differential Revision: D55240603 fbshipit-source-id: 3c725a164b40e176548af8ada9fcb13d391ef017 --------- Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com>
1 parent eed035a commit 2c62dca

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

packages/react-native/ReactAndroid/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,8 @@ android {
488488
}
489489
if (rootProject.hasProperty("ndkVersion") && rootProject.properties["ndkVersion"] != null) {
490490
ndkVersion = rootProject.properties["ndkVersion"].toString()
491+
} else {
492+
ndkVersion = libs.versions.ndkVersion.get()
491493
}
492494

493495
compileOptions {

packages/react-native/ReactAndroid/hermes-engine/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ android {
192192
}
193193
if (rootProject.hasProperty("ndkVersion") && rootProject.properties["ndkVersion"] != null) {
194194
ndkVersion = rootProject.properties["ndkVersion"].toString()
195+
} else {
196+
ndkVersion = libs.versions.ndkVersion.get()
195197
}
196198

197199
defaultConfig {

0 commit comments

Comments
 (0)