Eclipse Android Emulator won't launch - android

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)

Related

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

Run android emulator on headless linux machine

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

'sh: 1: file: not found' when creating a android emulator inside a docker container

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

Failed to load libGL.so on Android

I am using Ubuntu 12.04 (Precise Pangolin) with the Oracle JDK 7, and when I am running the Android emulator from Eclipse, it's giving this error:
[2012-07-04 02:52:10 - Emulator] error libGL.so: cannot open shared object file: No such file or directory
[2012-07-04 02:52:10 - Emulator] Failed to load libGL.so
Also the emulator is very slow. How can I solve this problem?
I have the Android SDK installed into ~/android-sdk-linux_x86, so I did:
ln -s /usr/lib/libGL.so.1 ~/android-sdk-linux_x86/tools/lib/libGL.so
This solves errors just like linking to /usr/lib does, but it doesn't require root and doesn't mess with core system directories.
On 64-bit Ubuntu 12.04, do it like this:
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Source: Installing required packages (Ubuntu 12.04)
I am using Ubuntu 12.04 64-bit. Using the following command to solve the problem
sudo ln -s /usr/lib32/fglrx/libGL.so.1.2 /usr/lib/libGL.so
Note: This is applicable only to those who use the AMD/ATI graphic drivers.
For 32-bit Ubuntu 12.04 LTS, this worked:
sudo apt-get install libgl1-mesa-dev
None of the following worked:
cd /usr/lib/i386-linux-gnu/mesa/
sudo ln -s libGL.so.1.2 libGL.so
sudo ln -s libGL.so.1.2 /usr/lib/libGL.so
ln -s libGL.so.1.2 ~/android/android-sdk-linux/tools/lib/libGL.so
What works for me (ubuntu 12.04 64bit) was just to run :
sudo apt-get install libgl1-mesa-dev
I found that libGL.so exists in directory /usr/lib/x86_64-linux-gnu/
Installation of 32 bit version was not working.
On 64 bit Ubuntu 12.04, there is no /usr/lib64. It is /usr/lib only.
Also, on my machine, libGL.so isn't present. Instead the file is libGLEW.so
To install /usr/lib/LibGL.so you can run:
sudo apt-get install libgl1-mesa-dev
However, it didn't solve the problem for me. In fact, it probably screwed up my system.
This worked for me on 64 bit Ubuntu 12.10 and the ADT bundle:
ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 ~/adt-bundle-linux-x86_64/sdk/tools/lib/libGL.so
If you don't have /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 just install libgl1-mesa-glx
sudo apt-get install libgl1-mesa-glx
I think I got it right, no warnings and no slowness... This might not work with proprietary drivers, though.
Make sure libgl1-mesa-glx:i386 is installed (even if you got a x64 SO file). Then do:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2 /usr/lib/libGL.so
NVidia Optimus:
Running on dual graphics (intel and nvidia), I used the following:
Install Bumblebee (see: https://wiki.ubuntu.com/Bumblebee#Installation)
Install the required lib.
Run the emulator on the nvidia discrete card.
This should do the trick:
sudo add-apt-repository ppa:bumblebee/stable
sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install bumblebee bumblebee-nvidia linux-headers-generic
sudo apt-get install ia32-libs
Whenever you wish to run the emulator, just use optirun:
optirun emulator #<avd_name>
I should give a warning that I only installed Linux yesterday. So I don't really know what I'm doing….
Referring to http://developer.android.com/sdk/installing/index.html, I installed ia32-libs and did:
ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2 /usr/lib/i386-linux-gnu/mesa/libGL.so
That's all I did to solve this problem.
I use Linux Mint 14 - 64 bit and for me, it worked :) :
sudo apt-get install libgl1-mesa-glx libgl1-mesa-dev
On Ubuntu 12.04 64-bit, GNOME 3.4, I first referred to http://developer.android.com/sdk/installing/index.html and installed ia32-lib, which will generate /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2.0
Then I run the below command and solved this problem:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2.0 /usr/lib/libGL.so
This is slightly different from gridstation's answer.
I guess there's no need to install the Mesa driver locally, which may cause issues with your real video drivers.
On Ubuntu 64 bit,
1. Check libGL,
$ locate libGL.so
/usr/lib/i386-linux-gnu/mesa/libGL.so.1
/usr/lib/i386-linux-gnu/mesa/libGL.so.1.2.0
/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0
2. Create a symlink where the SDK is installed
ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 /usr/local/android-studio/sdk/tools/lib/libGL.so
To make it work on a Ubuntu 12.10 (Quantal Quetzal) 64-bit, you have to do two things:
1) You have to initialize LD_LIBRARY_PATH
Example:
export LD_LIBRARY_PATH=~/tests/android/adt-bundle-linux-x86_64/sdk/tools/lib
Comments: change the path to your location
2) You have to create a symbolic link
a) Use locate libGL to find the correct library:
rudy#vsolutions:~$ locate libGL
/home/rudy/opt/android/android-sdk-linux/tools/lib/libGLES_CM_translator.so
/home/rudy/opt/android/android-sdk-linux/tools/lib/libGLES_V2_translator.so
/usr/lib/i386-linux-gnu/libGLU.so.1
/usr/lib/i386-linux-gnu/libGLU.so.1.3.1
...
/usr/lib32/nvidia-current/libGL.so.304.43
b) Create the soft link
sudo ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0 /usr/lib/libGL.so
Comments: use a 64-bit library on a 64-bit operating system!
Now start the emulator
My system is Optimus, and I have installed Bumblebee. I can use "Intel Open Source Technology Center" "Mesa DRI Intel(R) Ironlake Mobile " "2.1 Mesa 9.0" or "NVIDIA Corporation" "GeForce GT 330M/PCIe/SSE2" "3.3.0 NVIDIA 304.43".
a) Intel
/home/rudy/tests/android/adt-bundle-linux-x86_64/sdk//tools/emulator64-arm -avd avd_42 -scale 0.46 -gpu on -verbose
b) Nvidia
optirun /home/rudy/tests/android/adt-bundle-linux-x86_64/sdk//tools/emulator64-arm -avd avd_42 -scale 0.46 -gpu on -verbose
Comments:
I didn't see any difference between the Intel and the Nvidia cards... It is certainly because the emulator is not GPU intensive.
On my system an Intel Core i5, it took almost 1 minute to start the emulator... Please be patient... I find the emulator rather fast after it is loaded (the 1 minute to wait). If you start the emulator from the Eclipse IDE, then the emulator does a software emulation (the GPU is off) and took 1 min 30 to start... It is much more slower than using the Intel or Nvidia cards!!!
verbose is the parameter to use to display more diagnostics
optirun is the command to make use of the Nvidia on Bumblebee. If you don't have Bumblebee don't use it!
avd is a virtual device
gpu on to make use of the graphical card
OSError: libGL.so: cannot open shared object file: No such file or directory
It may appear on Linux systems when you try to launch VNL for the first time.
To solve it, create (as administrator) a new link in /usr/lib :
sudo ln -s /usr/lib/libGL.so.1.2 /usr/lib/libGL.so
If you have a 64-bit Linux, use /usr/lib64 instead .
First check that you actually have libGL.so.1.2 in /usr/lib or /usr/lib64 ; it might be called libGL.so.1 or something else instead, or located in another directory, depending on the video drivers.
You can use locate libGL to find the correct file to link to.
I had the same issue. But in my case, I solved it another (I think, better) way.
In my situation (Lubuntu 13.10), it was enough to simply also install the library libgl1-mesa-dev through Synaptic Package manager (the libgl1-mesa-dri library was already installed by default when the Lubuntuu distro was set up).
That solves all the hassle of putting links from one file to the other and also prevents polluting your system:
How will you know after several months (or years) what dedicated links you've put to keep the system running?
What about a future updates, if you start to do those things yourself? Will something be broken/not updated due to "manual intervention"?
If you use the "system mechanism", it's all done for you. And correctly done. That's why those tools are there in the first place.
Best rgds,
Similar to user1289608, I was able to do a sym link from an existing install of Mesa:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2 /usr/lib/libGL.so
I am using Ubuntu 12.04 64-bit. Linking /usr/lib64/libGLC.so.0 to /usr/lib64/libGL.so seems to solve the problem.
EDIT: It stops the error messages, but the emulator is still slow for me.
This worked for me:
Restart the adb from the DDMS:
In Eclipse: Window > Open Perspective... > Other > DDMS. Select the emulator from the left side pane and select "Restart adb"
You can also restart the adb server from the terminal window.
android-sdk-linux/platform-tools/adb kill-server
android-sdk-linux/platform-tools/adb start-server
I found the folder for libGL by the command "locate"
It turned out to be in /usr/lib/i386-linux-gnu/
~$ locate libGL
/usr/lib/i386-linux-gnu/libGLEW.so.1.8
/usr/lib/i386-linux-gnu/libGLEW.so.1.8.0
/usr/lib/i386-linux-gnu/libGLEWmx.so.1.8
/usr/lib/i386-linux-gnu/libGLEWmx.so.1.8.0
/usr/lib/i386-linux-gnu/libGLU.so.1
/usr/lib/i386-linux-gnu/libGLU.so.1.3.1
/usr/lib/i386-linux-gnu/mesa/libGL.so.1
/usr/lib/i386-linux-gnu/mesa/libGL.so.1.2.0
For my Debian 7 'Wheezy' installation I used the following command:
ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1 opt/android/tools/lib/libGL.so
sudo apt-get install libgl1-mesa-dev
cd ~/Development/adt-bundle-linux-x86_64-20140321/sdk/tools/lib
unlink libGL.so
ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0 libGL.so
that's it!
I had this problem because I had checked "Use Host GPU" when creating my AVD. I tried it with that option unchecked and I was able to successfully start the emulator. This is acceptable for my testing purposes, but if using the host GPU is important you'll probably want to try some of the other solutions here.
I had the same problem. Reinstalling the Nvidia driver fixed the segmentation fault for me.
I solved this problem by reinstalling libgl1, both the 64- and 32-bit libraries:
$ sudo apt-get install --reinstall libgl1-mesa-glx libgl1-mesa-glx:i386
Background: Previously I switched from the free radeon driver back to fglrx. I guess this somehow screwed up my libgl1, because fglrx comes with its own version.
Besides, I think that the other solutions provided here are possibly dangerous, because it is wrong to symlink 32 bit shared libraries into the (64 bit) /lib/ directory.
Check if you have libgl1-mesa-* packages installed. If so, install the libgl1-mesa-dev package to get the unversioned shared objects.
You shouldn't have to do this -- it's the Android team's error. Give them a break, they're only Java developers.

Android: ADB is somehow not working (on Fedora 16)

I'm running Fedora 16 x64 with xfce desktop. Installation of Android Developer Tools (adt plugin) was successfull from Eclipse. I can even run an Emulator. It's just that adb command is not working from the Linux command line. Even if I cd to the platform-tools folder and run adb devices I get this output:
bash: adb: command not found
Eclipse also reports an error about this. By the way adb file is marked as executable. Any help would be great...
I think the problem was already addressed here:
Problem with Android SDK on Fedora 14 with Eclipse
and here
Android SDK on a 64-bit linux machine
Please let me know.
adb is located under folder platform-tools and in order to run it you have 2 options.
Option 1: Add the SDK/platform-tools folder into your shell PATH (BASH I guess)
Option 2: go under the platform-tools folder and run it using: ./adb
for instance ./adb logcat
Cheers
sudo yum install android-tools -y

Categories

Resources