Build for Production

Deploy your React Native app to iOS App Store and Google Play Store using Expo EAS.

Prerequisites

  • Expo account (create at expo.dev)
  • Apple Developer account ($99/year) for iOS
  • Google Play Developer account ($25 one-time) for Android
  • EAS CLI installed: npm install -g eas-cli

Configure EAS

1. Login to EAS

bash
eas login

2. Configure Project

bash
eas build:configure

This creates eas.json:

eas.json
{
  "cli": {
    "version": ">= 5.0.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal",
      "ios": {
        "simulator": true
      }
    },
    "preview": {
      "distribution": "internal",
      "channel": "preview"
    },
    "production": {
      "channel": "production"
    }
  },
  "submit": {
    "production": {}
  }
}

App Configuration

Update app.json

app.json
{
  "expo": {
    "name": "Your App Name",
    "slug": "your-app-slug",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "userInterfaceStyle": "automatic",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "bundleIdentifier": "com.yourcompany.yourapp",
      "buildNumber": "1",
      "supportsTablet": true
    },
    "android": {
      "package": "com.yourcompany.yourapp",
      "versionCode": 1,
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#ffffff"
      }
    },
    "plugins": [
      "expo-router",
      "expo-font"
    ],
    "extra": {
      "eas": {
        "projectId": "your-project-id"
      }
    }
  }
}
Make sure to update bundleIdentifier (iOS) and package (Android) to your own unique identifiers!

Environment Variables

For API keys and secrets:

.env.production
EXPO_PUBLIC_API_URL=https://api.yourapp.com
EXPO_PUBLIC_ANALYTICS_KEY=your-key-here
eas.json
{
  "build": {
    "production": {
      "env": {
        "EXPO_PUBLIC_API_URL": "https://api.yourapp.com"
      }
    }
  }
}

Build Commands

iOS Build

bash
# Development build (simulator)
eas build --platform ios --profile development

# Preview build (TestFlight)
eas build --platform ios --profile preview

# Production build (App Store)
eas build --platform ios --profile production

Android Build

bash
# Development build
eas build --platform android --profile development

# Preview build (internal testing)
eas build --platform android --profile preview

# Production build (Play Store)
eas build --platform android --profile production

Build Both Platforms

bash
eas build --platform all --profile production

App Assets

Required Assets

  • Icon: 1024x1024px (icon.png)
  • Splash Screen: 1242x2436px (splash.png)
  • Adaptive Icon (Android): 1024x1024px (adaptive-icon.png)

Generate Assets

bash
npx expo-generate-icons

Testing Builds

Internal Testing (iOS)

  1. Build with --profile preview
  2. Install TestFlight app on your iPhone
  3. Scan QR code from EAS build page

Internal Testing (Android)

  1. Build with --profile preview
  2. Download APK from EAS build page
  3. Install on Android device

Submit to Stores

Submit to App Store

bash
eas submit --platform ios --latest

Submit to Play Store

bash
eas submit --platform android --latest
First submission must be done manually through App Store Connect and Google Play Console. Subsequent updates can use eas submit.

Over-the-Air (OTA) Updates

Push updates without rebuilding:

bash
# Publish update
eas update --branch production --message "Bug fixes"

# Check update status
eas update:list --branch production

Version Management

Increment Version

Update in app.json:

json
{
  "expo": {
    "version": "1.0.1",
    "ios": {
      "buildNumber": "2"
    },
    "android": {
      "versionCode": 2
    }
  }
}

Automated Builds

Automate with GitHub Actions:

.github/workflows/build.yml
name: EAS Build

on:
  push:
    tags:
      - 'v*'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      
      - uses: actions/setup-node@v3
        with:
          node-version: 18
      
      - name: Setup Expo
        uses: expo/expo-github-action@v8
        with:
          expo-version: latest
          eas-version: latest
          token: ${{ secrets.EXPO_TOKEN }}
      
      - name: Install dependencies
        run: npm ci
      
      - name: Build on EAS
        run: eas build --platform all --non-interactive --no-wait

Troubleshooting

Build Failed

  • Check build logs in EAS dashboard
  • Verify all required credentials are set
  • Ensure bundleIdentifier/package are unique

Common Issues

bash
# Clear build cache
eas build --clear-cache

# View build logs
eas build:view <build-id>

# List all builds
eas build:list

Next Steps