Skip to content

๐Ÿ“ฑ Mobile Development Setup Guide โ€‹

Stack: React Native 0.81 ยท Expo SDK 54 ยท Expo Router ยท NX Monorepo
Package manager: Yarn 1.x
App bundle ID: com.touli.development (dev) ยท com.touli (prod)


๐Ÿ“‹ Table of Contents โ€‹


Prerequisites โ€‹

Install these tools before anything else.

Both Platforms โ€‹

ToolVersionInstall
Node.js18+nodejs.org
Yarn1.22+npm install -g yarn
GitLatestgit-scm.com
bash
# Verify versions
node -v
yarn -v
git --version

Environment Setup โ€‹

Android Environment โ€‹

1 โ€” Install JDK 17 โ€‹

powershell
# Windows โ€” via winget
winget install Microsoft.OpenJDK.17

# macOS โ€” via Homebrew
brew install --cask temurin@17

Set environment variables (Windows โ€” run in new terminal after install):

powershell
# Windows (PowerShell โ€” set permanently)
[System.Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\Program Files\Microsoft\jdk-17.0.19.10-hotspot", "User")
bash
# macOS/Linux โ€” add to ~/.zshrc or ~/.bashrc
export JAVA_HOME=$(/usr/libexec/java_home -v 17)

Verify:

bash
java -version
# Expected: openjdk version "17.x.x"

2 โ€” Install Android Studio โ€‹

Download: developer.android.com/studio

During setup, install:

  • โœ… Android SDK
  • โœ… Android SDK Platform (API 35)
  • โœ… Android Virtual Device (AVD)

3 โ€” Set Android SDK Environment Variables โ€‹

Windows:

powershell
[System.Environment]::SetEnvironmentVariable("ANDROID_HOME", "$env:LOCALAPPDATA\Android\Sdk", "User")
# Add platform-tools to PATH
$current = [System.Environment]::GetEnvironmentVariable("PATH", "User")
[System.Environment]::SetEnvironmentVariable("PATH", "$current;$env:LOCALAPPDATA\Android\Sdk\platform-tools", "User")

macOS/Linux โ€” add to ~/.zshrc or ~/.bashrc:

bash
export ANDROID_HOME=$HOME/Library/Android/sdk          # macOS
# export ANDROID_HOME=$HOME/Android/Sdk               # Linux

export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/emulator

Then reload:

bash
source ~/.zshrc   # or source ~/.bashrc

Verify:

bash
adb devices
# Expected: List of devices attached (empty list is fine, means it's working)

iOS Environment โ€‹

macOS only โ€” iOS development requires a Mac with Xcode.

1 โ€” Install Xcode โ€‹

Install from the Mac App Store (free, ~14 GB).

Then install command-line tools:

bash
xcode-select --install
sudo xcodebuild -license accept

2 โ€” Install CocoaPods โ€‹

bash
sudo gem install cocoapods
# or via Homebrew
brew install cocoapods

Verify:

bash
pod --version
# Expected: 1.x.x

3 โ€” Install iOS dependencies โ€‹

bash
cd apps/mobile/ios
pod install
cd ../../..

Running the App โ€‹

โš ๏ธ First time only: You must build the native app before using the Metro dev server.
After the first build, you only need yarn dev:mobile:expo for JS changes.


Android Emulator โ€‹

Step 1 โ€” Create a Virtual Device (AVD) โ€‹

  1. Open Android Studio
  2. Go to Device Manager โ†’ Create Device
  3. Choose a device (e.g. Pixel 8) โ†’ Select API 35 system image โ†’ Finish
  4. Click โ–ถ to start the emulator

Step 2 โ€” Build & Install (first time) โ€‹

bash
yarn android

This compiles the native Android app and installs the com.touli.development APK on the running emulator. Takes ~3โ€“5 minutes on first run.

Step 3 โ€” Start Dev Server (daily use) โ€‹

bash
yarn dev:mobile:expo

The app will open automatically. Press a to open on Android if it doesn't.


Android Physical Device โ€‹

Step 1 โ€” Enable Developer Mode on your phone โ€‹

  1. Go to Settings โ†’ About Phone
  2. Tap Build Number 7 times
  3. Go back to Settings โ†’ Developer Options
  4. Enable USB Debugging

Step 2 โ€” Connect via USB โ€‹

bash
adb devices
# Expected output:
# List of devices attached
# XXXXXXXXXX    device

If it shows unauthorized, unlock your phone and tap Allow on the USB debugging prompt.

Step 3 โ€” Build & Install โ€‹

bash
yarn android

Step 4 โ€” Start Dev Server โ€‹

bash
yarn dev:mobile:expo

๐Ÿ’ก Wireless debugging (Android 11+): In Developer Options, enable Wireless debugging, then use adb pair and adb connect to go cable-free.


iOS Simulator โ€‹

Step 1 โ€” Open a Simulator โ€‹

bash
# List available simulators
xcrun simctl list devices available

# Open Simulator app (picks a default device)
open -a Simulator

Or launch from Xcode โ†’ Xcode menu โ†’ Open Developer Tool โ†’ Simulator.

Step 2 โ€” Build & Install (first time) โ€‹

bash
yarn ios

This compiles the native iOS app and installs it on the running simulator. Takes ~5โ€“8 minutes on first run.

Step 3 โ€” Start Dev Server (daily use) โ€‹

bash
yarn dev:mobile:expo

Press i to open on iOS if it doesn't launch automatically.


iOS Physical Device โ€‹

Step 1 โ€” Connect your iPhone via USB โ€‹

Step 2 โ€” Trust the computer โ€‹

Unlock your phone and tap Trust when prompted.

Step 3 โ€” Register your device in Xcode โ€‹

  1. Open apps/mobile/ios/mobile.xcworkspace in Xcode
  2. Go to Signing & Capabilities
  3. Select your Team (Apple ID โ€” free account works for dev)
  4. Xcode will register your device automatically

Step 4 โ€” Build & Install โ€‹

bash
yarn ios --device

If you have multiple devices, Xcode will prompt you to choose.

Step 5 โ€” Start Dev Server โ€‹

bash
yarn dev:mobile:expo

Daily Development Workflow โ€‹

Once the native app is installed, your everyday workflow is just:

bash
# Start Metro bundler โ€” hot reload works automatically
yarn dev:mobile:expo
KeyAction
aOpen on Android
iOpen on iOS
rReload app
mToggle dev menu
jOpen debugger
wOpen in browser
Ctrl+CStop server

When to re-run the full build โ€‹

Re-run yarn android / yarn ios only when:

  • โœ… You install a new native package (e.g. react-native-camera)
  • โœ… You change app.json native config (icons, permissions, plugins)
  • โœ… You pull changes that modified android/ or ios/ folders
  • โœ… Native build errors that Metro can't resolve

Troubleshooting โ€‹

โŒ JAVA_HOME is not set โ€‹

bash
# Check if Java is installed
java -version

# Windows โ€” set JAVA_HOME (replace version number as needed)
[System.Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\Program Files\Microsoft\jdk-17.0.19.10-hotspot", "User")
# Then restart terminal

โŒ No development build installed โ€‹

You're running yarn dev:mobile:expo before building the native app. Run the full build first:

bash
yarn android   # for Android
yarn ios       # for iOS

โŒ adb: command not found โ€‹

bash
# Windows โ€” add platform-tools to PATH
$current = [System.Environment]::GetEnvironmentVariable("PATH", "User")
[System.Environment]::SetEnvironmentVariable("PATH", "$current;$env:LOCALAPPDATA\Android\Sdk\platform-tools", "User")
# Restart terminal
bash
# macOS
export PATH=$PATH:$HOME/Library/Android/sdk/platform-tools

โŒ Gradle build failed (Android) โ€‹

bash
# Clean Gradle cache and rebuild
cd apps/mobile/android
./gradlew clean        # macOS/Linux
gradlew.bat clean      # Windows
cd ../../..
yarn android

โŒ CocoaPods error (iOS) โ€‹

bash
cd apps/mobile/ios
pod deintegrate
pod install
cd ../../..
yarn ios

โŒ Metro bundler cache issues โ€‹

bash
yarn dev:mobile:expo --clear
# or
npx expo start --clear

โŒ Device not detected by adb โ€‹

  1. Check USB cable (use data cable, not charge-only)
  2. Try a different USB port
  3. Revoke USB debugging authorizations and re-authorize
bash
adb kill-server
adb start-server
adb devices

Quick Reference โ€‹

bash
# โ”€โ”€โ”€ First time setup โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
yarn install                  # Install all dependencies
yarn android                  # Build & install Android dev client
yarn ios                      # Build & install iOS dev client

# โ”€โ”€โ”€ Daily development โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
yarn dev:mobile:expo          # Start Metro + hot reload

# โ”€โ”€โ”€ Utilities โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
adb devices                   # List connected Android devices
xcrun simctl list devices     # List iOS simulators (macOS)
cd apps/mobile/android && gradlew.bat clean  # Clean Android build (Windows)
cd apps/mobile/android && ./gradlew clean    # Clean Android build (macOS)

iOS Release Runbook โ€‹

For TestFlight/release flow (versioning, archive steps, smoke tests, and crash triage), see: