Set up Android development environment for React Native/Expo. Use when configuring Android Studio, Gradle, emulators, or troubleshooting Android-specific build issues. Invoked by: "android setup", "android studio", "gradle", "android environment", "android emulator".
Version: 1.0.0 Last Updated: 2026-01-11 Status: Active
Note: This is a template. Replace placeholders like
{PROJECT_NAME}and{BUNDLE_ID}with your actual project values.
Configure a complete Android development environment for building and running the mobile app on Android emulators and physical devices. This guide covers JDK installation, Android Studio setup, SDK configuration, emulator creation, and environment variables.
ALWAYS: Setting up Android development on macOS/Windows/Linux, Android Studio configuration, emulator setup, Gradle issues, SDK configuration SKIP: iOS-only development, web development
brew install openjdk@17 (macOS) or Adoptium (Windows)task run-android┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Install JDK │────>│ Install │────>│ Configure │
│ 17 │ │ Android Studio │ │ SDK │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
v
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Run on │<────│ Create │<────│ Set Env │
│ Emulator │ │ Emulator │ │ Variables │
└─────────────────┘ └─────────────────┘ └─────────────────┘
| Phase | Description | Time |
|---|---|---|
| 1 | Install JDK 17 | 5-10 min |
| 2 | Install Android Studio | 15-30 min |
| 3 | Configure SDK | 10 min |
| 4 | Set Environment Variables | 5 min |
| 5 | Create Emulator | 10 min |
| 6 | Verify Installation | 5 min |
Android requires JDK 17.
brew install openjdk@17
# Add to PATH (add to ~/.zshrc or ~/.bashrc)
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
export PATH="$JAVA_HOME/bin:$PATH"
Download and install from Adoptium (Eclipse Temurin JDK 17).
sudo apt install openjdk-17-jdk
java --version
# Should show version 17.x.x
Download from developer.android.com/studio
During installation, ensure these components are selected:
In SDK Platforms tab, install:
In SDK Tools tab, ensure these are installed:
Add to your shell profile (~/.zshrc or ~/.bashrc):
# macOS
export ANDROID_HOME=$HOME/Library/Android/sdk
# Linux
# export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
Then reload your shell:
source ~/.zshrc # or ~/.bashrc
ANDROID_HOMEC:\Users\<username>\AppData\Local\Android\SdkPath:
%ANDROID_HOME%\emulator%ANDROID_HOME%\platform-toolsadb --version
# Should output version info
From Android Studio:
From command line:
# List available emulators
emulator -list-avds
# Start emulator
emulator -avd <avd_name>
# Check Java version
java --version
# Check ADB
adb --version
# Check emulator
emulator -list-avds
# Check connected devices
adb devices
# Ensure environment is set up
task setup-dev
# Start emulator first (from Android Studio or command line)
# Then run
task run-android
# Ensure environment is set up
task setup-dev
# Start emulator first (from Android Studio or command line)
# Then run
task run-android
adb devices
# Should list your emulator or connected device
adb devices
# Should list your device
task run-android
Cmd+M (macOS) / Ctrl+M (Windows)Cmd+M (macOS) or Ctrl+M (Windows)# All React Native logs
adb logcat *:S ReactNative:V ReactNativeJS:V
# Filter for your app (replace with your bundle ID)
adb logcat | grep "{BUNDLE_ID}"
localhost:8081/debugger-uiIf you see Gradle sync issues:
android/ folder in Android StudioFor strange build issues:
# Run on Android
task run-android
# Build native project only
task build-android
# Regenerate native project
task generate
# Connect ADB for debugging
task adb-connect
# View logs
adb logcat | grep "ReactNative"
# List devices
adb devices
# List emulators
emulator -list-avds
# Start emulator
emulator -avd <avd_name>
# List devices
adb devices
# Install APK
adb install app.apk
# Uninstall app (replace with your bundle ID)
adb uninstall {BUNDLE_ID}
# Clear app data (replace with your bundle ID)
adb shell pm clear {BUNDLE_ID}
# Reverse port (for Metro connection)
adb reverse tcp:8081 tcp:8081
# Take screenshot
adb exec-out screencap -p > screenshot.png
# Record screen
adb shell screenrecord /sdcard/recording.mp4
| Issue | Solution |
|---|---|
| "SDK location not found" | Create android/local.properties with sdk.dir=/Users/<username>/Library/Android/sdk |
| "INSTALL_FAILED_INSUFFICIENT_STORAGE" | Run emulator -avd <avd_name> -wipe-data or increase storage in AVD settings |
| "Unable to load script" | Start Metro with task start, then run task run-android; for physical device run adb reverse tcp:8081 tcp:8081 |
| Emulator slow | Enable hardware acceleration (HAXM/Hypervisor), use x86_64 images, allocate more RAM |
| Build fails with memory error | Add org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m to android/gradle.properties |
| JAVA_HOME not set | Add export JAVA_HOME=$(/usr/libexec/java_home -v 17) to shell profile |
| Gradle sync failed | Open android/ in Android Studio and click "Sync Project with Gradle Files" |
| ADB not found | Ensure ANDROID_HOME and PATH are set correctly |
For consistent Node.js versions, use Volta (same as iOS setup):
# Install Volta
curl https://get.volta.sh | bash
# Setup Node 20
volta install node@20
volta pin node@20
Verify:
node --version # Should show v20.x.x
volta --version # Should show version info
| Skill | Purpose | When to Use |
|---|---|---|
/setup-dev | Full environment setup | Complete development environment |
/setup-ios | iOS environment | Setting up iOS development |
/setup-env | Environment variables | Configuring .env files |
/help | Issue diagnosis | When encountering build errors |
/deploy | App deployment | Building for Play Store |
Note: Skill paths (
/skill-name) work after deployment. In the template repo, skills are in domain folders.
End of SOP