Skip to main content
This guide covers setting up Android development for Rainbow Wallet on macOS, Linux, and Windows.

Prerequisites

Before setting up Android, ensure you have:

Installation Steps

1

Install JDK 17

Rainbow requires JDK 17. Do not use the JDK bundled with Android Studio (it’s JDK 21, which causes build failures).
Install Azul Zulu JDK 17 via Homebrew:
brew install --cask zulu@17
Verify installation:
/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home/bin/java -version
2

Configure Environment Variables

Add Android SDK and Java paths to your shell profile.
Add to ~/.zshrc:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home
export ANDROID_HOME=$HOME/Library/Android/sdk  # macOS
# export ANDROID_HOME=$HOME/Android/Sdk        # Linux
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools
For Linux, also install system dependencies:
sudo apt install libsecret-tools watchman
After adding environment variables, restart any open terminals for changes to take effect.
3

Install Android Studio

Download and install Android Studio from https://developer.android.com/studio.
  1. Run the installer
  2. Follow the standard setup wizard (recommended)
  3. Install Android SDK, SDK Platform, and Android Virtual Device
The wizard will install:
  • Android SDK
  • Android SDK Platform-Tools
  • Android SDK Build-Tools
  • Android Emulator
4

Configure Android Studio

After installation, configure Android Studio for Rainbow:

Increase IDE Memory

Rainbow is a large project. Increase the heap size:
  1. Android Studio → Settings → Memory Settings (macOS: Preferences → Memory Settings)
  2. Set IDE Heap Size to at least 4096 MB (default is 2048 MB)
  3. Click Save and Restart

Set Gradle JDK

Configure Gradle to use JDK 17 (not the bundled JDK 21):
  1. Settings → Build, Execution, Deployment → Build Tools → Gradle
  2. Under Gradle JDK, select the JAVA_HOME (Azul Zulu 17) entry
  3. Click Apply
The default Gradle JDK points to the bundled JDK 21, which will cause build failures.
5

Create Android Emulator

Create a virtual device for testing (skip if using a physical device):
  1. Open Android Studio → Device Manager (or Tools → Device Manager)
  2. Click Create Device
  3. Select a phone (e.g., Pixel 6)
  4. Download and select a system image (e.g., Android 13 - API 33)
  5. Click Finish
You can also use a physical Android device. Enable Developer Options and USB Debugging on your device.
6

Run First Gradle Build

Run the first build from the terminal to generate native headers needed for Gradle sync:
cd android
./gradlew assembleDebug
cd ..
This first build can take 5-15 minutes. Subsequent builds are much faster.
7

Open Project in Android Studio

Always launch Android Studio from the terminal so it inherits your shell environment (including node from nvm).
open -a "Android Studio"
Then in Android Studio:
  1. File → Open
  2. Select the android/ folder
  3. Wait for Gradle sync to complete
Always launch Android Studio from the terminal (not Spotlight/Dock/Start Menu). Launching from GUI won’t inherit your PATH, causing “Cannot run program node” errors during Gradle sync.

Android Build Configuration

Rainbow’s Android build is configured in android/build.gradle:
buildToolsVersion = "35.0.0"
minSdkVersion = 26
compileSdkVersion = 35
targetSdkVersion = 35
ndkVersion = "27.1.12297006"
kotlin_version = "2.1.20"

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

1

Check Java version

java -version
Should output: openjdk version "17.x.x"
2

Verify JAVA_HOME

echo $JAVA_HOME
Should point to JDK 17 installation.
3

Check Android SDK

echo $ANDROID_HOME
adb --version
adb (Android Debug Bridge) should be available.
4

List connected devices

adb devices
Should list your emulator or physical device (after starting it).
5

Test Gradle build

cd android
./gradlew tasks
Should list available Gradle tasks without errors.

Troubleshooting

Android Studio doesn’t have node in its PATH.Solution: Always launch Android Studio from terminal:
# macOS
open -a "Android Studio"

# Linux
studio.sh
This ensures Android Studio inherits your shell PATH (including nvm’s node).
You’re using the wrong JDK version (likely JDK 21 bundled with Android Studio).Solution:
  1. Install JDK 17 (see Step 1)
  2. In Android Studio: Settings → Build Tools → Gradle → Gradle JDK
  3. Select Azul Zulu 17
The android command is deprecated. Use Android Studio’s GUI or sdkmanager:
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --list
Check virtualization is enabled:macOS: Virtualization is built-in.Linux:
# Check if KVM is available
egrep -c '(vmx|svm)' /proc/cpuinfo

# Install KVM
sudo apt install qemu-kvm
Windows: Enable Hyper-V or HAXM in BIOS.
If you encounter persistent issues:
# Clean Android builds
yarn clean:android

# Or manually
cd android
./gradlew clean
rm -rf build
rm -rf app/build
cd ..

# Rebuild
cd android
./gradlew assembleDebug
cd ..
Metro bundler port is in use:
# Kill process on port 8081
lsof -ti:8081 | xargs kill -9

# Restart Metro
yarn start
Android SDK platform-tools are not in your PATH:
export PATH=$PATH:$ANDROID_HOME/platform-tools
Add to your shell profile to make it permanent.

Gradle Commands

Useful Gradle commands for Android development:
cd android

# List all tasks
./gradlew tasks

# Build debug APK
./gradlew assembleDebug

# Build release APK
./gradlew assembleRelease

# Build release bundle (for Play Store)
./gradlew bundleRelease

# Clean build
./gradlew clean

# Install debug build on device
./gradlew installDebug
Or use yarn scripts:
# Build release APK
yarn android:apk

# Build release bundle
yarn android:bundle

# Run Gradle command
yarn gradle assembleDebug

ADB Commands

Android Debug Bridge (adb) commands:
# List connected devices
adb devices

# Install APK
adb install android/app/build/outputs/apk/release/app-release.apk

# Uninstall app
adb uninstall me.rainbow

# Reverse ports for Metro bundler
adb reverse tcp:8081 tcp:8081

# View device logs
adb logcat

# Clear app data
adb shell pm clear me.rainbow
Yarn scripts for ADB:
# Reverse ports (single device)
yarn android-reverse-ports

# Reverse ports (all devices)
yarn android-reverse-ports-all

# Uninstall app
yarn uninstall:android

Next Steps

Running the App

Build and run Rainbow on Android

Building

Create production builds for Android

Additional Resources

Build docs developers (and LLMs) love