359

I am trying to run an Android Emulator by using AVD Manager. I have a Macbook Pro Retina. Installed the Haxm driver direct from intel page.

No emulator is working. All get the same "error" message.

Running Command (This error was when i used Homebrew for installing Android-sdk and Android-platform-tools | anyone who get the same problem should remove this or look where the conflict is)

export ANDROID_EMULATOR_DEBUG=1 test20

emulator:Found AVD name 'test20'
emulator:Found AVD target architecture: x86
emulator:Looking for emulator-x86 to emulate 'x86' CPU
emulator:Probing program: ./emulator-x86
emulator:Probing path for: emulator-x86
emulator:Found target-specific emulator binary: /usr/local/bin/emulator-x86
emulator:Probing for: /usr/local/bin/libOpenglRender.dylib
emulator:Probing for: /usr/local/bin/lib/libOpenglRender.dylib
emulator:Probing for: /usr/local/lib/libOpenglRender.dylib
emulator:Probing for: /usr/local/bin/lib64OpenglRender.dylib
emulator:Probing for: /usr/local/bin/lib/lib64OpenglRender.dylib
emulator:Probing for: /usr/local/lib/lib64OpenglRender.dylib
emulator:Could not find OpenGLES emulation host libraries!
emulator: ERROR: This AVD's configuration is missing a kernel file!!

emulator -avd test21
emulator:Found AVD name 'test21'
emulator:Found AVD target architecture: x86_64
emulator:Looking for emulator backend for x86_64 CPU
emulator:Probing program: ./emulator-x86_64
emulator:Probing path for: emulator-x86_64
emulator:Looking for emulator-x86 to emulate 'x86_64' CPU
emulator:Probing program: ./emulator-x86
emulator:Probing path for: emulator-x86
PANIC: Missing emulator engine program for 'x86_64' CPUS.

After I fixed the problem with Homebrew:

I tried a bit around and found this:

emulator64-x86 -avd test20
Creating filesystem with parameters:
    Size: 69206016
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 4224
    Inode size: 256
    Journal blocks: 1024
    Label: 
    Blocks: 16896
    Block groups: 1
    Reserved block group size: 7
Created filesystem with 11/4224 inodes and 1302/16896 blocks
emulator: ERROR: Could not load OpenGLES emulation library: dlopen(lib64OpenglRender.dylib, 1): image not found
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
HAX is working and emulator runs in fast virt mode
qemu: could not load PC BIOS 'bios.bin'

For all who has the same problem, maybe these steps help:

Run your Emulator in Debug mode:

export ANDROID_EMULATOR_DEBUG=1 emulatorName

If there is a path that look strange check for other installations like Homebrew and remove the conflict (uninstall one)

When the library is missing you need to export the variable:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ANDROID_HOME/tools/lib

And when error "qemu: could not load PC BIOS 'bios.bin'" appears, one fix is to run the emulator with the full path:

/Applications/Android\ Studio.app/sdk/tools/emulator64-x86 -avd test20
In your case it is maybe a other path.
Visores
  • 4,008
  • 4
  • 18
  • 29
  • 4
    in my case this error came up because the SDK manager didn't install the 32 bit binaries (emulator-arm and emulator-x86), but the emulator program still looked for them by default. Deleting and re-installing the sdk tools didn't add the 32 binaries for me. I can launch the emulator by running emulator64-arm -avd 'avdname' from Terminal, but I still can't get Android Studio's AVD manager to realize it needs to look for the 64 bit binary. Eclipse's AVD manager seems to be fine – CCJ Dec 15 '14 at 22:41
  • None of the PATH fixes worked for me, whether I was in `emulator` or `tools` - I had to manually specify the `-kernel` argument per this post https://stackoverflow.com/a/52161215/3700490 – Casey L Jun 08 '20 at 00:38
  • I've just left an actual solution, which solves the problem instead of working around it. – Martin Zeitler Jan 22 '21 at 00:46
  • Based off several of these answers, to save the hard work, I just did an uninstall and reinstall of the HAXM via SDK manager and the problem went away. – User51 Mar 29 '21 at 17:38

32 Answers32

548

If you are using macOS, add both Android SDK emulator and tools directories to the path:

Step 1: In my case the order was important, first emulator and then tools.

export ANDROID_SDK=$HOME/Library/Android/sdk
export PATH=$ANDROID_SDK/emulator:$ANDROID_SDK/tools:$PATH

Step 2: Reload you .bash_profile Or .bashrc depending on OS

Step 3: Get list of emulators available: $emulator -list-avds

Step 4: Launch emulator from the command line and Replace avd with the name of your emulator $emulator @avd

Don't forget to add the @ symbol.

This was tested with macOS High Sierra 10.13.4 and Android Studio 3.1.2.

vijay
  • 10,276
  • 11
  • 64
  • 79
enreas
  • 11,152
  • 3
  • 31
  • 32
  • 21
    This is the right answer as the $ANDROID_SDK/tools/emulator needs access to the types of emulator architecture found in the $ANDROID_SDK/emulator/ folder. – Robert Brisita Apr 23 '18 at 20:38
  • 12
    I wrote about this change [here](https://www.stkent.com/2017/08/10/update-your-path-for-the-new-android-emulator-location.html) if you're interested in some context :) – stkent May 15 '18 at 12:29
  • 2
    This same answer applies to Ubuntu 18.04 Bionic Beaver. – Basel Shishani Sep 01 '18 at 05:02
  • Nice. This also fixed an error: "Your emulator is out of date, please update by launching Android Studio" – Michael Bushe Nov 25 '18 at 05:24
  • What if you're using Windows? – niico Nov 28 '19 at 15:40
  • Maybe you could add `ANDROID_SDK` and modify `PATH` via environment variables, using System Properties dialog box. – enreas Nov 28 '19 at 16:01
  • The issue was persisting for me even after doing `source ~/.bash_profile` so I had to relaunch the terminal. The issue was resolved after this. If you get "../tools/emulator" when you run `which emulator`, the path has not been set properly. So just relaunch your terminal. – Sufian Apr 02 '21 at 16:01
  • not working for me !!! – Ali Yar Khan Oct 26 '21 at 12:38
  • on linux use: ``` export ANDROID_SDK=$HOME/Android/Sdk export PATH=$ANDROID_SDK/emulator:$ANDROID_SDK/tools:$PATH ``` (note no Library dir and cap S) If this doesn't work make sure you aren't running virtualbox! – AndrewStone Jan 11 '23 at 18:35
221

I had this issue after upgrading Android Studio to 3.2 and even upgrade some SDK-Packages.

The cause was that the path to emulator had changed, so don't use

...../Android/Sdk/tools/emulator

but instead

..../Android/Sdk/emulator/emulator
suther
  • 12,600
  • 4
  • 62
  • 99
68

The following work-around to start emulator-x86 worked for me:

cd $SDK/tools; 
ln -s emulator64-x86 emulator-x86

Or on Windows open Command Prompt (Admin)

cd %ANDROID_SDK_ROOT%\tools
mklink emulator64-x86.exe emulator-x86.exe

And now the emulator will start from the SDK manager.

IMPORTANT Note:

Emulators is located in emulators folder in more recent versions. (thanks to rmtheis for info)

suther
  • 12,600
  • 4
  • 62
  • 99
Tongfa
  • 2,078
  • 1
  • 16
  • 14
  • how can i fix it in windows? – Mahdi May 20 '17 at 06:51
  • Actually this solved my problem: `ln -s emulator64-x86 emulator-x86_64` – pylover Oct 07 '17 at 21:09
  • 115
    The emulators have been moved out of `tools` and into the `emulator` directory. – rmtheis Mar 20 '18 at 19:06
  • 16
    As @rmtheis says, more than creating a symbolic link and trying to cheat the system, you should check and add the correct executable in the path. Run `which emulator` to check which one is actually being picked. `/Users/{$USER_NAME}/Library/Android/sdk/emulator/emulator` is the right executable to be used. – Sameer Achanta Mar 30 '18 at 15:43
  • 1
    @Sameer - Not sure your suggestion fixes the same issue my solution did. My solution effectively fixes a bug in the SDK. IIRC, the SDK install did already configure the path, but unfortunately missed some critical binaries on 64 bit systems. Using `which` would not have found the correct binary since it was not in the path in the first place. I considered a path based solution, but felt the symlink solution is more likely to survive an upgrade and be self contained. Also, sounds like the SDK creators have moved things around since 2015, not sure my solution is relevant anymore. – Tongfa Apr 04 '18 at 23:35
  • 1
    @Tongfa I'm definitely hinting at the relevancy of your solution, more than its accuracy. With the way, the binaries have been moved around, one should definitely consider choosing the binaries in the `emulator` folder over the ones in the `tools` folder. You are right when you say that `which` wouldn't find the binary since it wasn't even in the path to begin with. In this case, any one who's viewing this problem, should use `which` as a confirmatory tool, and should make appropriate changes to give precedence to the binaries from the `emulator` folder. – Sameer Achanta Apr 05 '18 at 07:06
  • 12
    For CLI devs, change all `/Users/amama/Library/Android/sdk/tools/emulator @PIXEL_2_XL` to `/Users/amama/Library/Android/sdk/emulator/emulator @PIXEL_2_XL` – Ray Foss Jun 29 '18 at 17:23
  • 5
    @RayFoss' solution worked for me with Android 28 -- running `emulator/emulator.exe` instead of `tools/emulator`. – Mark Nov 03 '18 at 14:11
  • It worked. Actually emulators moved from `tools` folder to `emulator` folder – Shivam Bharadwaj Sep 08 '19 at 11:14
64

Navigate to the emulator folder located within Android SDK folder / emulator

cd ${ANDROID_HOME}/emulator

Then type these command to open emulator without android studio:

$ ./emulator -list-avds
$ ./emulator -avd Nexus_5X_API_28_x86

Nexus_5X_API_28_x86 is My AVD you need to give your AVD name

Christian Giupponi
  • 7,408
  • 11
  • 68
  • 113
abinthomas12914
  • 739
  • 5
  • 8
39

For Windows 10, 5.29.18 :

Using command promt I just got in the emulator directory:

cd C:\Android\sdk\emulator

and then typed the command:

emulator -avd Nexus_S_API_27

Nexus_S_API_27 is the name of my custom emulator.

Othewize it will abuse :

PANIC: Missing emulator engine program for 'x86' CPU.
Christian Giupponi
  • 7,408
  • 11
  • 68
  • 113
CodeToLife
  • 3,672
  • 2
  • 41
  • 29
  • 11
    In my case it throwed `PANIC: Missing emulator engine program for 'x86' CPU.` on valid AVD path. As described in https://stackoverflow.com/a/51627009/2914140, newer versions of emulators use `emulator/emulator` path, while I started from `tools/emulator`. – CoolMind Aug 08 '19 at 07:45
27

In my case by doing which emulator it returned $ANDROID_HOME/tools/emulator but it should be $ANDROID_HOME/emulator/emulator

So I just added $ANDROID_HOME/emulator before $ANDROID_HOME/tools in the PATH variable and it works fine now

Vemuri Pavan
  • 495
  • 7
  • 15
19

On Mac after installing Android Studio IDE android-studio-ide-173.4907809-mac.dmg and using studio SDK Manager to install SDK Tools

enter image description here

Add to your PATH using ~/.profile or ~/.bash_profile and make sure you have $ANDROID_HOME/emulator in your $PATH before $ANDROID_HOME/tools like so:

export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools

alias androidemulator='emulator -avd Nexus_5X_API_28_x86'
ilovett
  • 3,240
  • 33
  • 39
  • This led me to a simple solution on Windows 10 and Android Studio. For some unknown reason, emulator was not installed and Android Emulator was not checked.(though I used it last week, perhaps a botched update of Android Studio). Check it, click Apply button, install emulator, then all was good. – slogan621 Feb 17 '19 at 06:27
17

In my Case this works like a charm:

  1. Open Terminal

  2. Type: open ~/.bash_profile

  3. Add the following lines:

    export ANDROID_SDK=$HOME/Library/Android/sdk
    export PATH=$ANDROID_SDK/emulator:$PATH
    export PATH=$ANDROID_SDK/tools:$PATH
    export PATH=$ANDROID_SDK/tools/bin:$PATH
    export PATH=$ANDROID_SDK/platform-tools:$PATH
    export ANDROID_SDK_ROOT=$ANDROID_SDK 
    export ANDROID_AVD_HOME=$HOME/.android/and
    alias emulator='$ANDROID_SDK/emulator/emulator'
    
  4. Save (hit Command+S). You may close the window or not.

  5. Back to Terminal, type: source ~/.bash_profile

  6. Show the installed emulators: emulator -list-avds, something like:

    Pixel_2_API_29
    Pixel_3a_API_29
    Pixel_C_API_29
    
  7. Last, run the emulator: emulator @Pixel_2_API_29

Jeaf Gilbert
  • 11,495
  • 19
  • 78
  • 105
13

There are two named emulator binary file. which located under $SDK/tools/emulator another under $SDK/emulator/

  • please make sure you have the right emulator configure(need add $SDK/emulator to your env PATH

I have write a script to help me to invoke the avd list

    #!/bin/bash -e


    echo "--- $# $(PWD)"
    HOME_CURRENT=$(PWD)
    HOME_EMULATOR=/Users/pcao/Library/Android/sdk/emulator

    if [ "$#" -eq 0 ]
    then
        echo "ERROR pls try avd 23 or avd 28 " 
    fi

    if [ "$1" = "23" ]
    then
        echo "enter 23"
        cd $HOME_EMULATOR
        ./emulator -avd Nexus_5_API_23_Android6_ &
        cd $HOME_CURRENT
    fi

    if [ "$1" = "28" ]
    then
        echo "enter 28"
        cd $HOME_EMULATOR
        ./emulator -avd Nexus_5_API_28_GooglePlay_ &
        cd $HOME_CURRENT
    fi


Christian Giupponi
  • 7,408
  • 11
  • 68
  • 113
caopeng
  • 914
  • 13
  • 23
13

Tested on macOS Mojave 10.14.5.

Reason and Solution:

we use sdk/tools/emulator, we should use sdk/emulator.

WM-C02WM0T3HTD8:~ zgong$ emulator -avd Pixel_3_XL_API_Q_x86
PANIC: Unknown AVD name [Pixel_3_XL_API_Q_x86], use -list-avds to see valid list.
HOME is defined but there is no file Pixel_3_XL_API_Q_x86.ini in $HOME/.android/avd
(Note: Directories are searched in the order $ANDROID_AVD_HOME, $ANDROID_SDK_HOME/avd, and $HOME/.android/avd)
WM-C02WM0T3HTD8:~ zgong$ emulator -avd Pixel_3_XL_API_Q
PANIC: Missing emulator engine program for 'x86' CPU.

We could check the emulator location:

WM-C02WM0T3HTD8:~ zgong$ which emulator
/Users/zgong/Library/Android/sdk/tools/emulator

I did a bunch of googling and while most of the answers were about setting the paths correctly in terminal, it turns out it was actually to do with a shift in a recent version of the SDK, where the emulator app is located in /emulator instead of /tools. Leaving this here in case anyway runs into the same problem.

We need to use as below:

{sdk location}/emulator -avd {avd name}

Here is the real output:

WM-C02WM0T3HTD8:~ zgong$ /Users/zgong/Library/Android/sdk/emulator/emulator -avd Pixel_3_XL_API_Q
pc_memory_init: above 4g size: 40000000
emulator: WARNING: UpdateCheck: Failure: Error
emulator: WARNING: UpdateCheck: failed to get the latest version, skipping check (current version '29.2.1-5889189')
emulator: WARNING: UpdateCheck: Failure: Error
WebSocketServer listening on port 55850
Qt WebEngine ICU data not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64/resources. Trying parent directory...
Qt WebEngine ICU data not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64/resources. Trying parent directory...
Qt WebEngine ICU data not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64. Trying application directory...
Qt WebEngine ICU data not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64. Trying application directory...
Installed Qt WebEngine locales directory not found at location /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64/translations/qtwebengine_locales. Trying application directory...
Qt WebEngine locales directory not found at location /Users/zgong/Library/Android/sdk/emulator/lib64/qt/libexec/qtwebengine_locales. Trying fallback directory... Translations MAY NOT not be correct.
Installed Qt WebEngine locales directory not found at location /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64/translations/qtwebengine_locales. Trying application directory...
Qt WebEngine locales directory not found at location /Users/zgong/Library/Android/sdk/emulator/lib64/qt/libexec/qtwebengine_locales. Trying fallback directory... Translations MAY NOT not be correct.
Path override failed for key ui::DIR_LOCALES and path '/Users/zgong/.QtWebEngineProcess'
Path override failed for key ui::DIR_LOCALES and path '/Users/zgong/.QtWebEngineProcess'
Qt WebEngine resources not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64/resources. Trying parent directory...
Qt WebEngine resources not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64. Trying application directory...
Qt WebEngine resources not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64/resources. Trying parent directory...
Qt WebEngine resources not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64. Trying application directory...
[0403/154905.171893:WARNING:resource_bundle_qt.cpp(116)] locale_file_path.empty() for locale
[0403/154905.171871:WARNING:resource_bundle_qt.cpp(116)] locale_file_path.empty() for locale
Qt WebEngine ICU data not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64/resources. Trying parent directory...
Qt WebEngine ICU data not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64. Trying application directory...
Installed Qt WebEngine locales directory not found at location /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64/translations/qtwebengine_locales. Trying application directory...
Qt WebEngine locales directory not found at location /Users/zgong/Library/Android/sdk/emulator/lib64/qt/libexec/qtwebengine_locales. Trying fallback directory... Translations MAY NOT not be correct.
Path override failed for key ui::DIR_LOCALES and path '/Users/zgong/.QtWebEngineProcess'
Qt WebEngine resources not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64/resources. Trying parent directory...
Qt WebEngine resources not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64. Trying application directory...
[0403/154907.393116:WARNING:resource_bundle_qt.cpp(116)] locale_file_path.empty() for locale

Reference: https://www.reddit.com/r/androiddev/comments/a978kx/mac_can_run_emulator_fine_through_android_studio/

Francis Bacon
  • 4,080
  • 1
  • 37
  • 48
8

Simply follow the below steps specific to mac:

  1. go to: /Users/{username}/Library/Android/sdk/emulator

  2. ./emulator -list-avds

  3. ./emulator @avdName

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
jayesh
  • 3,277
  • 1
  • 18
  • 7
5

ON WINDOWS - updating the system path worked for me. Create an environment variable for the location of your sdk called ANDROID_SDK then add these to your path, in this order:

%ANDROID_SDK%\emulator
%ANDROID_SDK%\platform-tools
%ANDROID_SDK%\tools
%ANDROID_SDK%\tools\bin
Christian Giupponi
  • 7,408
  • 11
  • 68
  • 113
5

In my case, I needed to install Android Emulator from Sdk manager and it get fixed

enter image description here

Morteza Rastgoo
  • 6,772
  • 7
  • 40
  • 61
4

You can also try what is suggested here: https://www.stkent.com/2017/08/10/update-your-path-for-the-new-android-emulator-location.html

For short, run the emulator from the sdk/emulator folder

Bakhshi
  • 1,299
  • 16
  • 25
4

Hit below command. It work for me. Android has changed the emulator directory from /tools to sdk/emulator

/Users/yourusername/Library/Android/sdk/emulator/emulator -avd Pixel_API_27
Dima Kozhevin
  • 3,602
  • 9
  • 39
  • 52
3

Latest Android Studio path has changed.

Use below path to locate emulator

cd /Users/<username>/Library/Android/sdk/emulator

And then run this command

./emulator -avd Pixel_2_XL_API_28

My emulator name is "Pixel 2 XL API 28"

Enjoy!

Bhavesh Lathigara
  • 1,355
  • 1
  • 15
  • 25
2

You cannot start emulator-x86 directory, because it needs to have LD_LIBRARY_PATH setup specially to find the PC Bios and GPU emulation libraries (that's why 'emulator' exists, it modifies the path, then calls emulator-x86).

Did you update the first ouput ? It looks like 'emulator' is still finding ' /usr/local/bin/emulator-x86'

Digit
  • 2,073
  • 1
  • 13
  • 10
  • I don't now fixed it in my entry. I let it there if anyone else maybe have problems like this and see my problems, but I add a description to it :D – Visores Oct 24 '14 at 08:30
2

Try the following work-around to start emulator-x86:

export LD_LIBRARY_PATH=$SDK/tools/lib:$LD_LIBRARY_PATH
$SDK/tools/emulator-x86 <your-other-options>

Where $SDK is the path to your SDK installation. That's in a nutshell what 'emulator' tries to do. You might want to start emulator64-x86 instead of emulator-x86 if the former exists though.

Digit
  • 2,073
  • 1
  • 13
  • 10
  • 1
    Thanks anyway! you moved me a lot steps forward :). I used the export with the library path and startet the emulator. Now he tells me ### emulator64-x86 -avd test20 | HAX is working and emulator runs in fast girt mode | qemu: could not load PC BIOS 'bios.bin' ### one file is still missing – Visores Oct 24 '14 at 08:22
  • 1
    Okay this get fixed if I run the emulator with the full path, why ever Oo? /Applications/Android\ Studio.app/sdk/tools/emulator64-x86 -avd test20 Maybe you know how to fix this :D? – Visores Oct 24 '14 at 08:29
  • The problem with "bios.bin" was solved here: https://groups.google.com/forum/#!msg/adt-dev/gwcLeOTfxD4/kW-qebk0C-wJ – Visores Oct 24 '14 at 08:53
  • 1
    The emulators have been moved from `tools` into `emulator`. – rmtheis Mar 20 '18 at 17:10
2

Had the same issue on Windows7 64bit. The reason why it didn't was missing emulator-x86.exe file under sdk/tools. Fixed it by deleting Android SDK Tools using Android SDK Manager and installing it again. The file now exists and emulator works as expected.

Wytas
  • 193
  • 4
  • 11
  • 3
    After deleting Android SDK Tools - don't close sdk manager. Or you cannot install it again. Poor answer with out warnings. – kiranpradeep Oct 30 '14 at 14:59
  • Thanks a lot, this resolved my problem on windows 10 64 bit. I also kept my sdk manager opened as @Kiran suggested – BeeLabeille Sep 04 '18 at 22:06
2

I faced the same problem and never worked for me except until go to the emulator folder, I tried to export the emulator folder but not worked for me

cd $android_home/emulator and run emulator

, in the end, I write Elias for the command in .bashrc file

alias emulator="$ANDROID_HOME/emulator/emulator"
Mohannd
  • 1,288
  • 21
  • 20
1

Avast Antivirus is sensing emulator-arm.exe as a thread and blocking from some reasons. When you add it exclusions in Virus Chest page with right-click -> "restore and add to exclusions" it's not solved in future runnings. To solve this permanently in Avast 2015 :

Settings ->

Active Protection ->

File System Shield ->

Customize ->

Exclusions then add thread as a exclusion . And then press ok.

canmurat
  • 159
  • 11
1

Delete both Android SDK Tools and Android SDK PLatform-tools; then download both packages again. Now, create a new emulator and start it; it will work. You might be able to run your old emulators.

dira
  • 30,304
  • 14
  • 54
  • 69
  • 1
    Very important to install the emulator and then START IT from Android Studio so the emulator bootstraps android first – Harry May 02 '18 at 21:01
1

This worked for me on macOS:

echo 'export PATH=$PATH:'$HOME'/Library/Android/sdk/emulator:'$HOME'/Library/Android/sdk/tools:'$HOME'/Library/Android/sdk/platform-tools' >> ~/.bash_profile
source ~/.bash_profile
C.M.
  • 19
  • 3
1

First, check the path you get with which emulator and if you get /usr/local/share/android-sdk/tools/emulator then remove or rename that emulator (it's an old one) and instead use /usr/local/share/android-sdk/emulator/emulator which is the new path.

If you're using Homebrew and installed with brew cask install android-sdk android-studio then you need to:

  1. Verify your .bashrc or .zshrc that you have the correct paths set:
# Remove $HOME/Library/Android paths
# The new way is to use ANDROID_SDK_ROOT
export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"
# For good measure, add old paths to be backwards compatible with any scripts or 
whatnot. And to hopefully decrease confusion:
export ANDROID_HOME=$ANDROID_SDK_ROOT
export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk-bundle
  1. Then restart your terminal shell, and check your paths are as you expect them:

    set | grep ANDROID

  2. Finally, with correct paths set, you typically need to install the ndk and some tools:

    sdkmanager "ndk-bundle" "cmake;3.10.2.4988404" "lldb;3.1"

    and check the list for other pieces like this sdkmanager --list

I also closed Android Studio, removed the old Android/Sdk folder under my $HOME folder, and restarted Studio, and when it asked where my Sdk had gone, I pasted the Sdk path: /usr/local/share/android-sdk

Simon B.
  • 2,530
  • 24
  • 30
1

For Ubuntu users

If you are getting PANIC: Missing emulator engine program for 'x86' CPU. this error

Try starting your emulator from the emulator folder in SDK, like above

usama@usama-Aspire-V5-471:~/Android/Sdk/emulator$ ./emulator -avd Pixel_2_API_29
U.A
  • 2,991
  • 3
  • 24
  • 36
1

The issue stems from SDK changes, since emulator now has it's own directory.
I didn't notice (nor care) to run an outdated emulator, while it still worked ...
This is a stalled SDK migration. When running with the -verbose switch:

emulator -avd Nexus_6_API_R -verbose

One can see where it starts to panic:

emulator:try dir C:\Android\tools
emulator:Looking for emulator-x86 to emulate 'x86' CPU
emulator:Probing program: C:\Android\tools/emulator-x86.exe
PANIC: Missing emulator engine program for 'x86' CPU.

But there is no emulator-x86.exe available and the actual emulator resides in directory emulator. After uninstalling "SDK Tools" (while trying to reinstall them), that one entry unexpectedly vanished from the list, leaving an empty tools directory, which may be deleted and removed from PATH.

Using x86_64 emulation is not required nor suggested (as this will run the stalled version of the emulator). Adapting to the SDK path changes by uninstalling "SDK Tools" is rather "the answer". One probably could just replace tools with emulator on PATH, but this leaves clutter behind.


For comparison, the actual startup sequence of version 30.3.5.0 should look about like this:

emulator: Android emulator version 30.3.5.0 (build_id 7033400) (CL:N/A)
emulator: Found AVD name 'Nexus_6_API_R'
emulator: Found AVD target architecture: arm
emulator: argv[0]: 'emulator.exe'; program directory: 'C:\Android\emulator'

And if there may be follow up errors alike:

PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value

This means that the system image path inside the *.ini may be wrongful.
It helps to download the x86 system image and then create a new emulator.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
0

Example that works for me on OSX / MacOS (replace name of device)

~/Library/Android/sdk/emulator/emulator @Pixel_2_API_28 -no-snapshot -wipe-data
Evalds Urtans
  • 6,436
  • 1
  • 41
  • 31
0

Adding a virtual device with the lowest possible Android version that was acceptable in my case worked for me. (Before that I'd tried several recent Android versions and had been getting the Missing emulator engine program for 'x86_64' CPUS error.)

Nil
  • 174
  • 1
  • 3
  • 14
0

My problem was using the integrated terminal in VS Code. That showed me a different path setting (and so tools path instead of emulator path was shown in the first place). All you need is to change the global vscode settings by using the correct bash as described here: https://stackoverflow.com/a/53971796/3437868

Tai Truong
  • 668
  • 1
  • 8
  • 11
0

Here the issue was caused by the default AVD using hardware accelerated GLES when setting is "auto". Had to edit the AVD and set it to "Software - GLES 2.0"

settings

Giszmo
  • 1,944
  • 2
  • 20
  • 47
-1

This message means the 'emulator-x86' or 'emulator64-x86' program is missing from $SDK/tools/, or cannot be found for some reason.

First of all, are you sure you have a valid download / install of the SDK?

Digit
  • 2,073
  • 1
  • 13
  • 10
  • I thought I have a valid download. Downloaded it twice but I could try again. – Visores Oct 22 '14 at 08:05
  • and i tried again... same message. I removed all installed from sdk Manager, installed them back, removed all avd images and .... But it still does not work :/ At my Windows 7 PC I just need 5min and it run but something is wrong at my Mac :/ – Visores Oct 22 '14 at 10:40
  • Can you start manually from the command-line, i.e.: $SDK/tools/emulator @ If this doesn't work, can you try defining ANDROID_EMULATOR_DEBUG to 1, as in: export ANDROID_EMULATOR_DEBUG=1 $SDK/tools/emulator @ -verbose This should print information about what the program is trying to do (i.e. locating the engine binaries). Please let us know the output. – Digit Oct 22 '14 at 15:25
  • When i run emulator -avd test20 emulator: ERROR: This AVD's configuration is missing a kernel file!! – Visores Oct 22 '14 at 15:38
  • The following is extremely strange: emulator:Found target-specific emulator binary: /usr/local/bin/emulator-x86 Where did you install your SDK exactly? Is there really a file named /usr/local/bin/emulator-x86 on your machine (and if so, where does it come from?) – Digit Oct 22 '14 at 16:06
  • Yes the file /usr/local/bin/emulator-x86 exists. My Android SDK is located here: /Applications/Android Studio.app/sdk . But I don't know where the emulator-86 come from. I also installed phonegap via Home Brew, maybe from there? – Visores Oct 23 '14 at 12:12
  • It looks like HomeBrew installs its own version of the emulator that interacts badly with the version from the SDK. I recommend uninstalling phonegap to resolve the problem. – Digit Oct 23 '14 at 12:29
  • 1
    would explain why it worked some days ago, i will try. – Visores Oct 23 '14 at 12:56
  • I removed now with: brew unstinall android-platform-tools and brew uninstall android-sdk . The output from emulator if i run now in debug mode is: emulator:Found AVD name 'test20' emulator:Found AVD target architecture: x86 emulator:Looking for emulator-x86 to emulate 'x86' CPU emulator:Probing program: ./emulator-x86 emulator:Probing path for: emulator-x86 PANIC: Missing emulator engine program for 'x86' CPUS. I will try now to reinstall the files via the sdk-manager from Android Studio – Visores Oct 23 '14 at 13:24
  • I add the Debug print to my post. It seems not to be fixed :/ – Visores Oct 23 '14 at 15:51
-3

See if your .exe file is in your antivirus quarantine

Solutions:

  1. Download the adt-bundle again from https://developer.android.com/tools/sdk.
  2. Open the Zip File.
  3. Copy the missing .exe Files From the Folder \sdk\tools.
  4. Past the Copied Files in Your Android\sdk\tools Directory.
Christian Giupponi
  • 7,408
  • 11
  • 68
  • 113
MagicJ
  • 133
  • 1
  • 2