Enhance Android build instructions in CONTRIBUTING.md

Updated Android build instructions to include emulator support and environment variable setup.
This commit is contained in:
Gedeon 2025-12-08 08:37:23 -05:00 committed by GitHub
parent 86b906f956
commit e941d4f3de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -266,6 +266,8 @@ The React Native mobile app provides cross-platform iOS and Android support with
| Java | 17 | Android builds |
#### Quick Start
> [!important]
> If you're building for Android devices, it's imperative that you install NDK (26.1.10909125) and CMake in Android Studio's SDK Manager in order to build the aws-lc crypto library. You'll need to add the NDK path to your system's environment variable as `ANDROID_NDK` or `ANDROID_NDK_HOME`.
```bash
# 1. Install Go (required for aws-lc cryptographic library)
@ -286,11 +288,13 @@ bun install
# (Not required to ensure rebuilt core is bundled when making changes)
bun run prebuild:clean
# 5. Run on iOS simulator (from apps/mobile directory)
# 5. Run on iOS simulator or Android emulator (from apps/mobile directory)
bun ios
bun android
# 6. Run on physical iOS device (from apps/mobile directory)
# 6. Run on physical iOS or Android device (from apps/mobile directory)
bun ios --device "YourDeviceName"
bun android --device "YourDeviceName"
# You can find the device name by running `bunx expo devices`.
```
@ -336,12 +340,18 @@ Rust Core (libsd_mobile_core.a)
The Rust core must be built manually before running the app. The build script in the podspec is intentionally commented out to avoid build issues during Xcode compilation.
```bash
# Build for iOS (device + simulator) from project root
# Build for iOS/Android (device + simulator) from project root. iOS will only build on MacOS
cargo xtask build-mobile
# Libraries are output to:
# iOS
# apps/mobile/modules/sd-mobile-core/ios/libs/device/libsd_mobile_core.a
# apps/mobile/modules/sd-mobile-core/ios/libs/simulator/libsd_mobile_core.a
# Android
# apps/mobile/modules/sd-mobile-core/android/src/main/jniLibs/arm64-v8a/libsd_mobile_core.so
# apps/mobile/modules/sd-mobile-core/android/src/main/jniLibs/x86_64/libsd_mobile_core.so
```
#### Known Issues and Fixes
@ -387,6 +397,11 @@ pkill -f xcodebuild
rm -rf ~/Library/Developer/Xcode/DerivedData/Spacedrive-*
```
**Android build errors:**
`"Android NDK not found. Set ANDROID_NDK or ANDROID_NDK_HOME"`
If you haven't already, you'll need to install NDK (26.1.10909125) and CMake from Android Studio and add it as an environment variable to your system as either `ANDROID_NDK` or `ANDROID_NDK_HOME`. You can find the directory in the path of your Android SDK.
#### Adding New Native Functionality
To add new native functionality exposed to JavaScript: