Skip to main content

Android Emulator Setup Guide

This guide will walk you through the process of setting up an Android emulator for app development and testing.

Installing Android Studio

  1. Download and install Android Studio using one of these methods:

Configuring Android SDK

  1. Launch Android Studio

  2. From the welcome screen, click More Actions and select SDK Manager

  3. Navigate to Settings > Languages & Frameworks > Android SDK

  4. In the SDK Platforms tab:

    • Select the latest Android version (API level)
    • Make sure the box next to the selected version is checked
  5. Switch to the SDK Tools tab and ensure these components are installed:

    • At least one version of Android SDK Build-Tools
    • Android Emulator
    • Android SDK Platform-Tools
  6. Important: Note down the Android SDK Location path displayed at the top

    • You'll need this path for environment variables or other development tools
  7. Click Apply and then OK to begin the installation

    • Wait for all selected components to download and install
    • This may take several minutes depending on your internet connection

Configuration Setup

Create a config.json file with the following structure:

{
"WEBVIEW_CONFIG": {
"port": "3005",
"android": {
"buildType": "debug",
"emulatorName": "testPhone",
"sdkPath": "/path/to/your/Android/sdk",
}
}
}

Make sure to update the following fields:

  • sdkPath: Your Android SDK location
  • emulatorName: The name of your Android Virtual Device (AVD)
  • port: Your development server details

Creating a Virtual Device

  1. In Android Studio, click More ActionsVirtual Device Manager
  2. Click Create device
  3. Select hardware profile and system image
  4. Configure the device name to match your emulatorName in config.json
  5. Complete the setup by clicking Finish

Running the Emulator

To start the emulator, simply run:

npm run setupEmulator:android

This command will:

  • Validate your Android SDK setup
  • Check for any running emulators
  • Start the configured emulator if none is running

Best Practices

  • Keep your config.json up to date with correct paths and emulator names
  • Regularly update SDK tools and system images
  • Use the same emulator name in both Android Studio and your configuration
  • Close unused emulators to free up system resources