17

After a great deal of searchings, I'm can't solve this error when I run:

ionc cordova run android -ls

OUTPUT:

ANDROID_HOME=/Users/lucianokrebs/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home
No target specified and no devices found, deploying to emulator        
No emulator specified, defaulting to Nexus_5_API_P

Waiting for emulator to start...

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

And the emulator never starts

Also, when I run:

$ ${ANDROID_SDK_ROOT}/tools/emulator -avd my-custom-avd

I got: PANIC: Missing emulator engine program for 'x86' CPU.

But, when I run:

$ ${ANDROID_SDK_ROOT}/emulator/emulator -avd my-custom-avd

the emulator starts and works fine

Seems that the cordova set the wrong path when they try to starts the emulator. Someone already deal with that?

ionic info:
    cli packages: (/usr/local/lib/node_modules)
    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0 

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 7.0.0 ios 4.5.4
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node  : v8.9.4
    npm   : 5.6.0 
    OS    : macOS High Sierra
    Xcode : Xcode 9.3 Build version 9E145 

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

p.s: when I run ionic cordova build android its also works fine

9 Answers 9

23

From SDK tools version 25.3.0 onwards, the emulator has been removed and moved to ../sdk/emulator.

Just set ${ANDROID_SDK_ROOT}/emulator to your $Path variable so that emulator can be called from the command line and ionic cordova will detect the emulator.

5
  • 1
    Yes! Seems that it fix the problem. For those who are facing the same problem and are coming from the ionic documentation from macOS setup page, double check this answer Apr 2, 2018 at 19:41
  • This seems like the answer I'm looking for. But I'm afraid it's not detailed enough to help. How do I update my $path variable, and which part of the macOS setup page does this relate to? Oct 10, 2018 at 9:32
  • 1
    @JesperBylund The section on Environment Variables should help.. or check something like stackoverflow.com/questions/7501678/…
    – Suraj Rao
    Oct 10, 2018 at 9:36
  • Is restart required for take effect changing path? May 26, 2019 at 15:43
  • 1
    @HamidAraghi not in a mac if you have set in bash_profile.. you need to source it or restart terminal...
    – Suraj Rao
    May 27, 2019 at 8:16
9

It seems that the above answers worked for you which is great but for anyone else still encountering the error, make sure to check which system image your android virtual device is using (you can check on android studio under the 'API' column in the AVD list).

Check that you're not using anything too new, I tried using 28 and 27 and neither worked but 26 (Android Oreo 8.0) did

1
  • worked for me with 26 API and not with 27-28. Thanks! Jun 4, 2019 at 11:48
4

For Windows Users:

Just add this to PATH variable

C:\Users\lenovo\AppData\Local\Android\Sdk\emulator
4

I had the same problem but adding "sdk/emulator" to my PATH (I'm on Windows) did not work. The reason was that both tools and emulator folders contained an emulator.exe. In the PATH variable, I moved the "sdk/emulator" folder UP, before the "sdk/tools" folder, so that it gets checked first when looking for emulator.exe and it solved my issue.

1

I had the same error

Effectively the @Suraj Rao answer is correctly, but with this changes, my emulator does not run with ionic cordova emulate android. I changed also in the variable enviroment, in my $path this

${ANDROID_SDK_ROOT}\tools\bin

for this

${ANDROID_SDK_ROOT}\emulator\bin

I closed cmd and open again. Then, ionic cordova emulate android runs ok!

1
  • Great! Good to know. I usually run ionc cordova run android -ls to start android emullator Apr 12, 2018 at 16:32
0

I tried many of these things and while this may not be the solution for all, I'm sure Windows users could find it helpful...I decided to start over and I ran one of the sample training programs for Kotlin. The instructions provide the set up Android Studio. I ended up with different errors which led to the solution below.

https://codelabs.developers.google.com/codelabs/build-your-first-android-app-kotlin/index.html#1

The problem is related to HAXM. While it's installed in the SDK manager, you must run the Intel program that sits in the SDK folder to fully access it. Browse to:

C:\Users\username\AppData\Local\Android\Sdk\extras\intel\Hardware_Accelerated_Execution_Manager 

and right click, run as admin, on the file intelhaxm-android.exe FIXED...

0

For Windows Users:

1 - Add this to PATH variable C:\Users\NameUserAccount\AppData\Local\Android\Sdk\emulator

2 - Restart Windows.

0

Simple solution is to first run the android emulator from AVD manager and then start the application on android using "cordova run android" Also, make sure ANDROID_SDK_ROOT is set to path shown in Android SDK Manager (you can check it using Android Studio).

0

Run your virtual device in Android studio and then run the command

cordova run

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.