I am running latest version of Mac OS and I want to run android emulator through command line tool. I have run the following command on Mac terminal and got the following error.
$ emulator -list-avds
Pixel_XL_API_28
$ emulator -avd Pixel_XL_API_28
PANIC: Missing emulator engine program for 'x86' CPU.
I also run the command with available options like below that is also available on official documentation developer.android.com
$ /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Pixel_XL_API_28 -netdelay none -netspeed full
What I need to do, so that I don't need to open android studios every time for only opening simulator.
Please follow the steps in your terminal in Mac
Step 1 ( Add Environment Variable )
export ANDROID_HOME=/Users/$(whoami)/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools
Step 2 ( .bash_profile / .bashrc )
Reload you .bash_profile Or .bashrc depending on OS
Step 3 ( go to emulator directory )
cd /Users/$(whoami)/Library/Android/sdk/emulator
Step 4 ( Get all list of Advs )
emulator -list-avds
Step 5 ( Run your Emulator Command Mode )
emulator -avd Nexus_5_API_22_Android_5.1
Take a look here : Android Emulator Error Message: "PANIC: Missing emulator engine program for 'x86' CPUS."
Then go as follows by cmd :
(the path to your emulators) - C:\Users\user\AppData\Local\Android\Sdk\emulator>
(the emulator name) - emulator.exe #Nexus_5 -dns-server 8.8.8.8 -writable-system
Related
I tried to develop app using Flutter(using Android studio IDE).Add flutter plugin & flutter SDK in studio and Everything is configured but emulator / real time device are not listed. Its shows error like "Unable to list devices: Unable to discover Android devices. Please run "flutter doctor" to diagnose potential issues"
Ref link : https://flutter.io/setup-windows/#android-setup
https://flutter.io/get-started/test-drive/#androidsstudio
configure flutter in terminal to detect Android SDK and Android Studio:
$ flutter config --android-sdk /path/to/android/sdk
$ flutter config --android-studio-dir /path/to/android/studio
then restart Android Studio/Intellij.
source: https://github.com/flutter/flutter-intellij/issues/2113#issuecomment-383412308
If you configure flutter and android sdk both perfectly and you do not show the avd device list in android studio.
It's very simple way to show android emulator device list.
First create a new Android Emulator if already create you run the AVD manager then you can show the instead of emulator name
Before:
https://i.stack.imgur.com/6np0m.png
After:
https://i.stack.imgur.com/fiCYe.png
May be there is no AVD's to list down. And if emulator runnig, intelliJ will grab it.
In Android Studio, you can create a AVD using AVD Manager or using Terminal. Here is how you can do that using Terminal,
First, go to the android sdk installed directory -> tools
and copy the path and in the terminal type cd and paste the path and press enter. Now yo are in the tools directory.
Next, using terminal type:
emulator -list-avds - to list created AVD's(You should be in tools directory to run this command).
If there is a device type emulator -avd <name>. else you can create a one:
type cd bin then,
Use:
avdmanager create avd -n name -k "sdk_id" [-c {path|size}] [-f] [-p path]
As a example:
avdmanager create avd -n Nexus -d 23 -k system-images;android-23;google_apis;x86
Then again go back to tools directory by typing cd .. and type emulator -list-avds. This command will list your created AVD.
To run a AVD type:
emulator -avd <name>
About AVD.
Had the same problem after moving avd's to another disk.
I managed to solve by making ANDROID_HOME system variable to point to the android sdk path.
For mac users,
It was working fine yesterday. In my case I had this in .bash_profile
ANDROID_HOME = Library/Android/sdk
I changed it to,
ANDROID_HOME = /Users/rana.singh/Library/Android/sdk
.bash_profile has
export ANDROID_HOME=/Users/rana.singh/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
It worked.
I am trying to run android emulator on my linux headless machine. I install android sdk, required platofrms and so on. I already created android avd using following command
android create avd -n TestDevice4.4.2 -t 17 ( 17 is id of from targets list )
Now i try to start emulator by following command
emulator -avd TestDevice4.4.2 -no-skin -no-window
And i got the following error on my terminal.
/home/ubuntu/sdk-android/tools/emulator64-arm: error while loading
shared libraries: libGL.so.1: cannot open shared object file: No such
file or directory
Since it is the first time setting up from termial in headless linux machine, i faced several issues. I can't figure out what's going on with this one. Appreciate your help :-)
EDITED
I've seen similar issues here. I had to install following library and create symbolink in sdk/tools/lib dir.
sudo apt-get install libgl1-mesa-dev
ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0 libGL.so
After done these steps, i start emulator again. i got following problem :-(
sh: 1: glxinfo: not found emulator:
ERROR: This AVD's configuration is
missing a kernel file!! emulator: ERROR: ANDROID_SDK_ROOT is undefined
For each version of Android you want to run, install at least:
1) Platform SDK (eg 17 for 4.2 version)
2) A system image for the emulator (eg ARM EABI v7a System Image )
bye
I'm trying to create a android emulator inside a docker container but got some problems.
The SDK updates and AVD creation were successful and i try to create the emulator, the following error appears:
./emulator -avd test-22 -no-skin -no-audio -no-window
sh: 1: file: not found
sh: 1: file: not found
WARNING: Cannot decide host bitness because $SHELL is not properly defined; 32 bits assumed.
ERROR: 32-bit Linux Android emulator binaries are DEPRECATED, to use them
Notes: Running last docker version and using java:8-jdk image.
My dockerfile can be found here => https://gist.github.com/leoGalani/1f74621b8e82bd5bc8db586d1f34b8a2
-- Some people told me to install a x86 intel ABI/ARM for the API22 but i cant manage to find the package name so i can install it by command line.
I have same issue and i fix this with install file comman via apt. But still not working yet, i will update when i found a solution.
apt-get install -y --no-install-recommends file libmagic1 libglu1-mesa mesa-utils libpci3 pciutils libpulse0
Edit:
I found a solution after add packages to your docker file
add your docker file these commands too
mv /bin/sh /bin/sh.backup
cp /bin/bash /bin/sh
And create new container with
--device /dev/dri --device /dev/video0 --device /dev/snd --device /dev/kvm
Most probably is work now.
I solved the same problem by using emulator64 instead emulator.
In this case:
emulator64 -avd test-22 -no-skin -no-audio -no-window
I have installed Eclipse 4.2 with Eclipse android plugin(ADT)on ubuntu 11.10. when i launch "Hello World" project as an android application, it simply wont launch!
ps -x > log.txt after launching the emulator, output:
1000 7221 20.0 0.6 16884 6908 ? D 18:11 0:00 /home/tutakhail/android-sdks/tools/emulator-arm -avd AndroidBrowser -netspeed full -netdelay none
launching the emulator manually from shell, i get the following error, shortly after which the emulator launches but is very slow.
emulator: ERROR: Could not load OpenGLES emulation library: libOpenglRender.so: cannot open shared object file: No such file or directory
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
Any hints on what could be the issue here? Perhaps related to Ubuntu?
Turns out the solution is to point LD_LIBRARY_PATH to the /tools/lib path.
Below works for me.
➜ tools file ../tools/lib/libOpenglRender.so
../tools/lib/libOpenglRender.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped
➜ tools export LD_LIBRARY_PATH=/home/xxxx/devel/android-sdk-linux/tools/lib:$LD_LIBRARY_PATH
➜ tools ./emulator-x86 -avd AtomX86 -gpu on -qemu -m 1024 -enable-kvm
emulator: emulator window was out of view and was recentered
....
I guess its a bug affecting the latest versions of the ADTs perhaps has something to do with NVIDIA GPUs drivers. The issue is discussed here:
https://groups.google.com/forum/?fromgroups#!topic/adt-dev/nlA07toW1fc
The work around that I have found which at least lets me execute my applications till a permanent solution is released, is that by first launching the emulator from shell even if it throws the error. After which i right-click and run my projects as an "Android application". The emulator does surprisingly execute them!
I've got similar error, and I guess this error caused by missing libGL.so.
Install package libgl1-mesa-dev;
sudo apt-get install libgl1-mesa-dev
Source
Try running emulator from command line first to see if everything goes well.
You may need to add options like:
-no-audio
-gpu off
I've seen audio preventing emulator to start on some Ubuntu configurations.
I tried to use the Intel Hardware Acceleration in Ubuntu 12.04 for running emulators using KVM package. However I was getting the error, "Failed to start RenderThread". Installing the package libgl1-mesa-dev and reducing the Device RAM Size to 512 solved my problem. The emulator now is indeed atleast 10X faster. I hope this would help someone trying to emulate android devices in Ubuntu using Intel processor that supports Virtualizattion Technology.
SO i guess maybe you haven't installed everything properly.
You should check if you followed the steps as shown in :
http://www.wikihow.com/Install-Android-on-Ubuntu-Linux-With-Eclipse-Ide
After installing it properly and setting up the PATH environment variables .
Also another thing you can do is try deleting the AVD emulator and creating a new one and then try again .
Also i found your question over here at : https://groups.google.com/forum/?fromgroups#!topic/adt-dev/nlA07toW1fc
THe question you asked is not really specific so just try following the steps.
The following command saved my life with the same problem
sudo apt-get install libgl1-mesa-dev
If using eclipse, you have to add in Project-Properties in the "Java Build Path" -> Libraries -> Android 4.4 -> "Native library location" the path to sdk/tools/lib directory.
For me this is "install-dir-of-sdk"/sdk/tools/lib"
Configure ANDROID_HOME
export ANDROID_HOME=//android-sdk-macosx
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
and set LD_LIBRARY_PATH
export LD_LIBRARY_PATH="$ANDROID_HOME/emulator/lib64:$LD_LIBRARY_PATH"
To run ARM version
cd $ANDROID_HOME/emulator/
./emulator64-arm -avd Nexus_5X_ARM_22 -no-audio -gpu off
I solved this on my Red Hat Linux 64 bit by installing the 32bit libGL (it should be located in /usr/lib/)
sudo yum install mesa-libGL.i686
libOpenglRender.so and other necessary files are present, indeed, in tools/lib64, while avd tries to find them in tools/lib
Making symbolic links to the files and dirs helped (in my case)
ln -s ../lib64/qt qt
ln -s ../lib64/gles_mesa gles_mesa
ln -s ../lib64/libstdc++ libstdc++
ln -s ../lib64/lib64GLES_V2_translator.so lib64GLES_V2_translator.so
ln -s ../lib64/lib64emugl_test_shared_library.so lib64emugl_test_shared_library.so
ln -s ../lib64/lib64OpenglRender.so lib64OpenglRender.so
ln -s ../lib64/lib64GLES_CM_translator.so lib64GLES_CM_translator.so
ln -s ../lib64/lib64EGL_translator.so lib64EGL_translator.so
(seems to be bug in original config, as that happens with fresh install of the studio/sdk)
When I use the Mac OS X Terminal to navigate to the folder with my Android Emulator and type emulator, I get:
command not found
Here's what happens:
$ emulator
-bash: emulator: command not found
How do I get it to work?
The current directory is not normally included in your $PATH on a *nix operating system like OS X; to execute a program in the current directory, precede it with the path to the current directory (.):
$ ./emulator
Emulator can be added with Android Studio https://developer.android.com/studio/run/managing-avds.html
To start emulator: ~/Library/Android/sdk/tools/emulator -avd Nexus_5X_API_23
Related question: How do I launch the Android emulator from the command line?
solutions
1. Symbolic link
steps
create one symbolic link emulator
# soft link
$ ln -s ~/Library/Android/sdk/tools/emulator /usr/local/bin/emulator
call the command
# check all avd
$ emulator -list-avds
$ emulator #avd_name
# OR
$ emulator -avd avd_name
2. system environment
edit env with vim/vscode
# zsh
$ vim ~/.zshrc
# OR
$ code ~/.zshrc
add below lines to the .zshrc file
# export ANDROID_SDK_ROOT=/Users/xgqfrms/Library/Android/sdk
export ANDROID_SDK_ROOT=~/Library/Android/sdk
export ANDROID_HOME=~/Library/Android/sdk
export ANDROID_AVD_HOME=~/.android/avd
update config
# flush update
$ source ~/.zshrc
refs
https://developer.android.com/studio/run/emulator-commandline
These 3 command works for me on VS Code Terminal (Mac Book Pro M1)
echo 'export PATH=$PATH:~/Library/Android/sdk/emulator/' >> ~/.bash_profile
source ~/.bash_profile
emulator -list-avds
Open Android Studio. Click on AVD Manager (the icon with the android and phone) [example image: AVD Manager]. See the list of emulators. You should see something like "Install Emulator" if you don't have any.
Once this is successful, you'll get the tools folder downloaded to your ~/Library/Android/sdk
That is the folder you want, because it has the android and emulator command line tools.
typcally i use from terminal :
./Library/Android/sdk/emulator/emulator *some action*