Mac and "PANIC: Missing emulator engine program for 'arm' CPU."

I am attempting to run an AVD I have created for API 16 on a Galaxy Nexus:

emulator @Galaxy_Nexus_Jelly_Bean_API_16

which gives the error

PANIC: Missing emulator engine program for 'arm' CPU.

Attempting to start it by pressing the play button from the AVD Manager inside Android Studio bounces something briefly in the tool dock, but it quickly vanishes and nothing shows up and there are no obvious error messages.

I have looked through other posts with similar problems. Most cite Avast on Windows as causing the issue. I am running on a Mac. I do not have Avast installed.

The AVD has the following configuration:

Name: Galaxy_Nexus_Jelly_Bean_API_16
CPU/ABI: Google APIs ARM (armeabi-v7a)
Path: /Users/prisoner/.android/avd/Galaxy_Nexus_API_16.avd
Target: google_apis [Google APIs] (API level 16)
Skin: galaxy_nexus
SD Card: 100 MB
hw.dPad: no
hw.lcd.height: 1280
runtime.network.speed: full
hw.accelerometer: yes
hw.device.name: Galaxy Nexus
vm.heapSize: 80
skin.dynamic: yes
hw.device.manufacturer: Google
hw.lcd.width: 720
hw.gps: yes
hw.initialOrientation: Portrait
image.androidVersion.api: 16
hw.audioInput: yes
image.sysdir.1: add-ons/addon-google_apis-google-16/images/armeabi-v7a/
hw.cpu.model: cortex-a8
tag.id: google_apis
showDeviceFrame: yes
hw.camera.back: virtualscene
hw.mainKeys: no
AvdId: Galaxy_Nexus_Jelly_Bean_API_16
hw.camera.front: emulated
hw.lcd.density: 320
avd.ini.displayname: Galaxy Nexus Jelly Bean API 16
hw.arc: false
hw.gpu.mode: auto
hw.device.hash2: MD5:5c288d27461585ecc73a535555e7cf61
hw.ramSize: 1024
hw.trackBall: no
PlayStore.enabled: false
fastboot.forceColdBoot: no
hw.battery: yes
hw.cpu.ncore: 4
hw.sdCard: no
tag.display: Google APIs
runtime.network.latency: none
hw.keyboard: yes
hw.sensors.proximity: yes
disk.dataPartition.size: 800M
hw.sensors.orientation: yes
avd.ini.encoding: UTF-8
hw.gpu.enabled: yes

Android Studio environment:

Android Studio 3.1.4
Build #AI-173.4907809, built on July 23, 2018
JRE: 1.8.0_152-release-1024-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.6

I have installed everything for this version of the SDK available in the SDK Manager:

enter image description here

I have the latest version of the emulator installed. I've tried uninstalling and re-installing it.

enter image description here

The ANDROID_HOME environment variable appears to be correctly set (it matches the Android SDK location in the SDK Manager. The emulator program appears to be the one under this home environment as well:

Mulan:~ prisoner$ echo $ANDROID_HOME
/Users/prisoner/Library/Android/sdk
Mulan:~ prisoner$ which emulator
/Users/prisoner/Library/Android/sdk/tools/emulator

As far as I can tell, the emulator and the architecture-specific emulators are also under ANDROID_HOME:

enter image description here

I'm at a loss about where else to look, either for error messages or the emulator that is there, but can't be found by the system, or how else to address the problem.

Update 1: Specify path explicitly.

Trying to specify the paths explicitly doesn't work either:

Mulan:~ prisoner$ /Users/prisoner/Library/Android/sdk/tools/emulator @Galaxy_Nexus_Jelly_Bean_API_16
PANIC: Missing emulator engine program for 'arm' CPU.
Mulan:~ prisoner$ /Users/prisoner/Library/Android/sdk/emulator/emulator @Galaxy_Nexus_Jelly_Bean_API_16
emulator: ERROR: This AVD's configuration is missing a kernel file! Please ensure the file "kernel-qemu" is in the same location as your system image.
emulator: ERROR: ANDROID_SDK_ROOT is undefined

Sure enough, ANDROID_SDK_ROOT isn't defined. Defining it to the same thing as ANDROID_HOME does the following:

Mulan:~ prisoner$ export ANDROID_SDK_ROOT="$ANDROID_HOME"
Mulan:~ prisoner$ /Users/prisoner/Library/Android/sdk/emulator/emulator @Galaxy_Nexus_Jelly_Bean_API_16
emulator: ERROR: This AVD's configuration is missing a kernel file! Please ensure the file "kernel-qemu" is in the same location as your system image.
emulator: ERROR: ANDROID_SDK_ROOT is defined (/Users/prisoner/Library/Android/sdk) but cannot find kernel file in /Users/prisoner/Library/Android/sdk/system-images/ sub directories

Looking underneath the system-images directory, we see a directory for each API platform:

Mulan:~ prisoner$ ls ~/Library/Android/sdk/system-images/
android-16  android-19  android-23  android-26
android-17  android-21  android-24  android-27
android-18  android-22  android-25  android-28

Looking just under the android-16 directory, we have

./default
./default/armeabi-v7a
./default/armeabi-v7a/build.prop
./default/armeabi-v7a/kernel-qemu
./default/armeabi-v7a/NOTICE.txt
./default/armeabi-v7a/package.xml
./default/armeabi-v7a/ramdisk.img
./default/armeabi-v7a/source.properties
./default/armeabi-v7a/system.img
./default/armeabi-v7a/userdata.img
./default/mips
./default/mips/build.prop
./default/mips/kernel-qemu
./default/mips/NOTICE.txt
./default/mips/package.xml
./default/mips/ramdisk.img
./default/mips/source.properties
./default/mips/system.img
./default/mips/userdata.img
./default/x86
./default/x86/build.prop
./default/x86/kernel-qemu
./default/x86/kernel-ranchu
./default/x86/NOTICE.txt
./default/x86/package.xml
./default/x86/ramdisk.img
./default/x86/source.properties
./default/x86/system.img
./default/x86/userdata.img
./google_apis
./google_apis/x86
./google_apis/x86/advancedFeatures.ini
./google_apis/x86/build.prop
./google_apis/x86/kernel-qemu
./google_apis/x86/kernel-ranchu
./google_apis/x86/NOTICE.txt
./google_apis/x86/package.xml
./google_apis/x86/ramdisk.img
./google_apis/x86/source.properties
./google_apis/x86/system.img
./google_apis/x86/userdata.img

Solution 1:

Just tried and verified on my Mac, to solve this problem, you need to specify the -kernel path manually. i.e.

$ ~/Library/Android/sdk/emulator/emulator  @Galaxy_Nexus_Jelly_Bean_API_16 -kernel ~/Library/Android/sdk/system-images/android-16/default/armeabi-v7a/kernel-qemu

Some references for you:

  1. Emulator error: This AVD's configuration is missing a kernel file

  2. https://developer.android.com/studio/run/emulator-commandline

--- Edit ---

To avoid typing the -kernel argument every time, you can also copy the ~/Library/Android/sdk/system-images/android-16/default/armeabi-v7a/kernel-qemu file to ~/Library/Android/sdk/add-ons/addon-google_apis-google-16/images/armeabi-v7a.

Solution 2:

Maybe it is the emulator tool path issue. Try to specify the full path of your emulator path.

Try the answer from here. Windows emulator.exe PANIC: Missing emulator engine program for 'x86' CPU

Solution 3:

[Partial answer - to a related issue on the IDE]

I have faced this problem also. My Android Studio couldn't even start the emulator, coming up with an error like "Emulator: Process finished with exit code 1". The fix there was to install/update the relevant system images under SDK Manager -> SDK Platforms (tab) -> Click "Show Package Details" and then "Apply".

sdk manager update platforms enter image description here

However, this doesn't seem to make the CLI command emulator -avd <avd name> run, instead I see the PANIC error, but apparently it's related to the migration of the emulator from the SDK path /tools to /emulator