Prerequisites
Before setting up Android, ensure you have:- ✅ Prerequisites installed (Node.js, Ruby)
- ✅ Dependencies installed (
yarn install && yarn setup)
Installation Steps
Install JDK 17
Rainbow requires JDK 17. Do not use the JDK bundled with Android Studio (it’s JDK 21, which causes build failures).
- macOS
- Linux
- Windows
Install Azul Zulu JDK 17 via Homebrew:Verify installation:
Configure Environment Variables
Add Android SDK and Java paths to your shell profile.
- macOS / Linux (zsh)
- macOS / Linux (bash)
- Windows
Add to For Linux, also install system dependencies:
~/.zshrc:Install Android Studio
Download and install Android Studio from https://developer.android.com/studio.
- Run the installer
- Follow the standard setup wizard (recommended)
- Install Android SDK, SDK Platform, and Android Virtual Device
- Android SDK
- Android SDK Platform-Tools
- Android SDK Build-Tools
- Android Emulator
Configure Android Studio
After installation, configure Android Studio for Rainbow:
Increase IDE Memory
Rainbow is a large project. Increase the heap size:- Android Studio → Settings → Memory Settings (macOS: Preferences → Memory Settings)
- Set IDE Heap Size to at least 4096 MB (default is 2048 MB)
- Click Save and Restart
Set Gradle JDK
Configure Gradle to use JDK 17 (not the bundled JDK 21):- Settings → Build, Execution, Deployment → Build Tools → Gradle
- Under Gradle JDK, select the
JAVA_HOME(Azul Zulu 17) entry - Click Apply
Create Android Emulator
Create a virtual device for testing (skip if using a physical device):
- Open Android Studio → Device Manager (or Tools → Device Manager)
- Click Create Device
- Select a phone (e.g., Pixel 6)
- Download and select a system image (e.g., Android 13 - API 33)
- Click Finish
You can also use a physical Android device. Enable Developer Options and USB Debugging on your device.
Run First Gradle Build
Run the first build from the terminal to generate native headers needed for Gradle sync:
This first build can take 5-15 minutes. Subsequent builds are much faster.
Android Build Configuration
Rainbow’s Android build is configured inandroid/build.gradle:
Minimum SDK
- minSdkVersion: 26 (Android 8.0)
- Supports Android 8.0 and above
Target SDK
- targetSdkVersion: 35 (Android 15)
- compileSdkVersion: 35
NDK Version
- ndkVersion: 27.1.12297006
- Native Development Kit for C/C++ libraries
Verify Android Setup
Troubleshooting
Gradle sync failed: 'Cannot run program node'
Gradle sync failed: 'Cannot run program node'
Android Studio doesn’t have This ensures Android Studio inherits your shell PATH (including nvm’s
node in its PATH.Solution: Always launch Android Studio from terminal:node).Build fails with 'Unsupported Java version'
Build fails with 'Unsupported Java version'
You’re using the wrong JDK version (likely JDK 21 bundled with Android Studio).Solution:
- Install JDK 17 (see Step 1)
- In Android Studio: Settings → Build Tools → Gradle → Gradle JDK
- Select Azul Zulu 17
Command 'android' not found
Command 'android' not found
The
android command is deprecated. Use Android Studio’s GUI or sdkmanager:Emulator fails to start
Emulator fails to start
Check virtualization is enabled:macOS: Virtualization is built-in.Linux:Windows: Enable Hyper-V or HAXM in BIOS.
Clean Android build
Clean Android build
If you encounter persistent issues:
Port already in use (8081)
Port already in use (8081)
Metro bundler port is in use:
adb: command not found
adb: command not found
Android SDK platform-tools are not in your PATH:Add to your shell profile to make it permanent.
Gradle Commands
Useful Gradle commands for Android development:ADB Commands
Android Debug Bridge (adb) commands:Next Steps
Running the App
Build and run Rainbow on Android
Building
Create production builds for Android