lucianokrebs
lucianokrebs

Reputation: 861

ionic cordova run android results in PANIC: Missing emulator engine program for 'x86' CPU

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

Upvotes: 17

Views: 13947

Answers (9)

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

cordova run

Upvotes: 0

vikram singh
vikram singh

Reputation: 38

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).

Upvotes: 0

Clement Peronneaud
Clement Peronneaud

Reputation: 49

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.

Upvotes: 4

For Windows Users:

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

2 - Restart Windows.

Upvotes: 0

Cajetan Rodrigues
Cajetan Rodrigues

Reputation: 51

For Windows Users:

Just add this to PATH variable

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

Upvotes: 4

map
map

Reputation: 1

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...

Upvotes: 0

Izas
Izas

Reputation: 19

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!

Upvotes: 1

Nicholas Xie
Nicholas Xie

Reputation: 121

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

Upvotes: 9

Suraj Rao
Suraj Rao

Reputation: 29625

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.

Upvotes: 23

Related Questions