Site icon ashishb.net

Troubleshooting Android Emulator: “Emulator: Process finished with exit code 1”

Emulator: Process finished with exit code 1

You opened AVD Manager in Android Studio and tried to start an AVD, you got
“Emulator: Process finished with exit code 1”. Following are the steps to debug
this

  1. Find out the name of the emulator.
    Click the down arrow 🔽 which is to the right of play arrow ▶️, to find out the name of the AVD. Let’s say the name is “Nexus_5X_API_28_x86”.
  2. Try starting the AVD directly from command-line
    It fails with another cryptic error, but that’s at least more actionable
    $(dirname $(which android))/emulator -avd Nexus_5X_API_28_x86
    ...
    PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value [/opt/android_sdk]!

    Let’s retry in the verbose mode to see a detailed error

    $(dirname $(which android))/emulator -avd Nexus_5X_API_28_x86 -verbose
    ...
    Not a directory: /opt/android_sdk/system-images/android-28/google_apis/x86/
    

    So, the system image is missing.

  3. Install system image
    # List all possible system images.
    $(dirname $(which android))/bin/sdkmanager --list
    # List the images we are interested in.
    $(dirname $(which android))/bin/sdkmanager --list | ack google_apis | ack android-28 | ack x86
    # Install the right one using
    $(dirname $(which android))/bin/sdkmanager --install 'system-images;android-28;google_apis;x86'
    
  4. Now try starting the AVD again.
    $(dirname $(which android))/emulator -avd Nexus_5X_API_28_x86 -verbose
    ...
    emulator:Probing program: /opt/android_sdk/tools/emulator64-x86
    emulator:Probing program: /opt/android_sdk/tools/emulator-x86
    PANIC: Missing emulator engine program for 'x86' CPU.
    

    Turns out there is another version of the emulator installed in $(dirname $(dirname $(which android)))/emulator/emulator. And the emulator I was using is a stray one.

    # This works
    $(dirname $(dirname $(which android)))/emulator/emulator -avd Nexus_5X_API_28_x86 -verbose
    
Exit mobile version