Run android emulator on headless linux machine - android

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

Related

Android emulator errors with "emulator: ERROR: can't find SDK installation directory"

I am trying to install and run an Android Virtual Device from the command line on Windows (without Android Studio). I have set up an Android SDK in C:\Android, and successfully created an AVD with the command:
avdmanager create avd -n test -k "system-images;android-26;google_apis_playstore;x86" --abi google_apis_playstore/x86
I have environment variable ANDROID_SDK_ROOT set to C:\Android.
When I try to start the emulator from the command line with:
emulator #test
I get errors:
emulator: ERROR: can't find SDK installation directory
emulator: could not find virtual device named 'test'
I have also tried setting environment variables ANDROID_AVD_HOME and ANDROID_EMULATOR_HOME, and also tried running the AVD specifying sysdir and datadir with the command:
emulator #test -sysdir C:\Android\system-images\android-26\google_apis_playstore\x86 -datadir C:\Android\avd
but I get the same errors.
When I run command avdmanager.bat list avd, I get:
Name: test
Path: C:\Android\avd\test.avd
Target: Google Play (Google Inc.)
Based on: Android API 26 Tag/ABI: google_apis_playstore/x86
Why on earth can't I run the AVD?
I found the problem. Because I was trying to do a minimal Android SDK install via the command line, I did not yet have a platform-tools folder. Not being able to find the platform-tools folder was causing the emulator to display the unhelpful error "can't find SDK installation directory", which really meant "can't find the platform-tools directory".
Once I installed the platform-tools folder with sdkmanager --no_https "platform-tools", the emulator worked. I need --no_https because I'm in a crippled corporate environment.
For future reference, I installed the emulator dependencies (after unzipping sdk-tools-windows-3859397.zip from here) with:
sdkmanager --no_https "system-images;android-26;google_apis_playstore;x86" "platforms;android-26" "platform-tools" "emulator"
With the package "platform-tools", it may also required to install "platforms;android-26" for your Android 26.
Using sdkmanager.bat platforms;android-30 --sdk_root=C:\your_avd_sdk_root to install it.
If still not working, try to run command below:
set PATH=%PATH%;%ANDROID_SDK_ROOT%\emulator
set PATH=%PATH%;%ANDROID_SDK_ROOT%\emulator\bin64
set PATH=%PATH%;%ANDROID_SDK_ROOT%\platform-tools
set PATH=%PATH%;%ANDROID_SDK_ROOT%\cmdline-tools\latest\bin

Android Emulator Error "Missing emulator engine program for 'x86' CPU" when using -engine classic

I just updated our build server's Android Studio to 2.3.1 and somehow along the way the emulator stopped working for the Jenkin's Android Emulator Plugin. The plugin calls the following command:
emulator -engine classic -ports 5754,5755 -report-console tcp:5866,max=60 -avd Nexus_4_API_23 -no-snapshot-load -no-snapshot-save -no-audio -gpu off
This used to always work but now it suddenly returns with the following error:
PANIC: Missing emulator engine program for 'x86' CPU.
The emulator version is 26.0.0 as reported by the Android SDK Manager. Opening the emulator through Android Studio works fine so I played around with the command a bit and the result is that the -engine classic flag is causing this, otherwise the emulator starts without problems.
As the Jenkins Emulator plugin depends on the -engine classic flag I can't remove it. Has anyone experienced this and found a solution?
I think the problem is caused because there are many files with the name of 'emulator' in the android sdk folder.
To invoke the the emulator from the terminal window,
Your bash file should be created properly, the path to emulator folder should be added in the bash file and make sure it comes before platform-tools and tools paths. this is because there are emulator files in these folders as well.
bash file should be-->
nano ~/.bash_profile
export ANDROID_HOME=Users/YOUR_MAC/Library/Android/sdk
export PATH=$ANDROID_HOME/emulator:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/tools/bin:$PATH
after doing this all you need to do is navigate to 'emulator' folder through terminal by-->
cd Users/YOUR_MAC/Library/Android/sdk/emulator
Now to invoke the emulator you created through android studio, just enter this command ./emulator #NexusDemo
your emulator name should be followed by #.
I fixed it now by downgrading the Android SDK tools, as seen at How to downgrade my SDK Version?
There seems to be something wrong with version 26 at the moment, or they disabled the classic engine or something. I was not able to find anything in the release notes though.
I recently came back to this issue and what fixed it for me are the tips in the following jenkins issue:
https://issues.jenkins-ci.org/browse/JENKINS-43557
Specifically:
Add to global Jenkins environment variables:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ANDROID_HOME/tools/lib
Add to android-emulator-plugin->Advanced->Emulator options:
-engine auto
This is what it looks like with the emulator plugin v2.15

Jenkins: could not create Android emulator failed to parse AVD config file

I have a Jeknins installation on my local PC. I'm successfully able to integrate Android application code with github and generate .apk file as an artifact.
The problem is in the test case execution. I cannot get the Android emulator to start.
It says:
\sdk/tools/android.bat" create avd -f -a -c 500M -s 480x640 -n hudson_en-US_480_480x640_android-21_armeabi-v7a -t android-21 --abi armeabi-v7a
[android] Could not create Android emulator: Failed to parse AVD config file
Recording test result.
I have already tried this:
Could not create Android emulator: Failed to parse AVD config file
Also, I ran the same create command from command line and it successfully craeted the AVD.
Not a complete answer, but it seems that the andoid Sdk update that came out recently - SDK Tools, Revision 25.3.0 (March 2017) - has made some significant changes.
The Android emulator jenkins plugin uses the android command (/home/jenkins/Android/Sdk/tools/android), but if I copy the commands from the console output and try and run that from the command line on the Jenkins machine I get:
[android] /home/jenkins/Android/Sdk/tools/android create avd -f -a -s HVGA -n hudson_en-US_120_HVGA_7.02 -t 7.02
[android] Could not create Android emulator: Failed to parse AVD config file
and try and run that from the command line on the Jenkins machine I get:
The android command is no longer available.
For manual SDK and AVD management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
So it seems that from 25.3.0 onwards, the 'android' command is deprecated and has been removed, but the emulator plugin hasn't been updated to reflect this.
As a solution, the best bet seems to be to install an earlier version of the android Sdk that still supports the 'android' command, at least until the plugin is updated.
Try leaving the sdcard field empty.
I ran the command that the android plugin printed out via a shell script and added -v (for verbose) after android.
I then saw that the problem was that it could not create an sdcard.
When not filling in an sdcard size, it worked.

Processing cannot create AVD

I am trying to run a Processing sketch on Android emulator. I get the following error-
debug:
Unhappy inside exists()
D:\android-sdks\tools\android.bat list avds
status: 1
375ms
stdout:
stderr:
D:\android-sdks\tools\android.bat create avd -n Processing-0215 -t android-10 -c 64M -s WVGA800
status: 1
308ms
stdout:
stderr:
at bottom of ensure proper
I tried running android.bat separately and that won't run either. But AVD Manager runs fine. I can create, run and delete emulators using AVD Manager.
Is it a problem with Android SDK installation or Processing?
How do i fix this?
Operating System: Windows 7 (64-bit)
Processing: 2.0b7
Android SDK: API level 10
EDIT:
Running android.bat gives me this-
ERROR: No suitable Java found. In order to properly use the Android Developer
Tools, you need a suitable version of Java JDK installed on your system.
We recommend that you install the JDK version of JavaSE, available here:
http://www.oracle.com/technetwork/java/javase/downloads
You can find the complete Android SDK requirements here:
http://developer.android.com/sdk/requirements.html
I'm perplexed by the fact that AVD Manager runs but android.bat doesn't.

Eclipse Android Emulator won't launch

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)

Categories

Resources