If your Linux is x86_64 system then is likely that sound in Android emulator will not work out of the box. Tools in Android SDK are 32-bit so Linux should have i686 libraries installed to enable fully functioning of SDK tools. If you get missing libraries error and the warning “opening audio output failed” right after starting emulator then this post will be helpful for you. On the other hand, i386 / i686 Linux systems should not be affected with this kind of problems and sound will probably work – please comment to confirm.
In my case, location of Android SDK is /usr/local/ directory. I didn’t want to unzipped it in home directory because unzipped SDK has 398MB in size. First, lets see file type of emulator-x86 (the same result will be for the rest of executables in tools directory) and hardware platform of Linux system:
> file /usr/local/android-sdk-linux/tools/emulator-x86 emulator-x86: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked ... > uname -i x86_64
As you can see, SDK tools are 32-bit software and if Linux OS is 64-bit then it needs 32-bit libraries. As a root user run the following yum command to install “basic” 32-bit support to the x86_64 Linux:
> yum install glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i686
Now it’s time to start Android emulator from the command line. Emulator expects the name of AVD (Android Virtual Device) as input parameter. If your AVD is not already created, open AVD Manager from Eclipse and create it in a few steps. This is really easy and you should only be careful to choose “Intel Atom x86 System Image” as a target otherwise you will create an (slow) ARM emulator. The virtual device name should be written after -avd parameter. In my case AVD name is “Android_x86” (and yes, it’s case sensitive):
> /usr/local/android-sdk-linux/tools/emulator-x86 -avd Android_x86
The emulator will be probably started but with the following errors displayed on terminal:
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. emulator: warning: opening audio output failed
OK, let’s find these OpenGLES libraries:
> locate libGLES /usr/local/android-sdk-linux/tools/lib/libGLES_CM_translator.so /usr/local/android-sdk-linux/tools/lib/libGLES_V2_translator.so
Don’t forget that this HOWTO is made for Linux OS where SDK is unzipped in /usr/local/ directory. If you have placed SDK on the other location then settings will be different but the principle is the same. So, the printed errors mean that although libraries exist on the system, they are unknown to the ld.so (dynamic linker). New conf file should be created in /etc/ld.so.conf.d/ dir with library path (it’s important that name of ld configuration file ends with .conf). Please see the content of android.conf file (it is only one line with absolute path to the lib directory):
> cat /etc/ld.so.conf.d/android.conf /usr/local/android-sdk-linux/tools/lib
If the same error is displayed (as in the previous step) after emulator is started then it’s needed to run ldconfig as a root to recreate library cache:
At this moment previous error should be replaced with the new one. Don’t be discouraged because probably some i386 / i686 packages are missing. Here is error message in my case:
Failed to load libGL.so error libGL.so: cannot open shared object file: No such file or directory Failed to load libGL.so error libGL.so: cannot open shared object file: No such file or directory emulator: warning: opening audio output failed
libGL.so belongs to the Mesa libGL runtime library. Emulator complains because it can’t find 32-bit Mesa libs. Start the following yum command to install Mesa for the i386 / i686 architecture:
> yum install mesa-libGLw.i686
Try to start Android emulator. If the error remains from the previous step then check existence of /usr/lib/libGL.so file and add symbolic link in /usr/lib/ directory. Here are few steps to proceed as a root user:
> cd /usr/lib > ls -la libGL* lrwxrwxrwx 1 root root 12 Aug 23 14:02 /usr/lib/libGL.so.1 -> libGL.so.1.2 -rwxr-xr-x 1 root root 502800 Jun 25 19:11 /usr/lib/libGL.so.1.2 lrwxrwxrwx 1 root root 15 Aug 23 14:02 /usr/lib/libGLw.so.1 -> libGLw.so.1.0.0 -rwxr-xr-x 1 root root 20700 Jan 14 2012 /usr/lib/libGLw.so.1.0.0 > ln -s libGL.so.1.2 libGL.so > ls -la libGL* lrwxrwxrwx 1 root root 12 Aug 23 14:06 /usr/lib/libGL.so -> libGL.so.1.2 lrwxrwxrwx 1 root root 12 Aug 23 14:02 /usr/lib/libGL.so.1 -> libGL.so.1.2 -rwxr-xr-x 1 root root 502800 Jun 25 19:11 /usr/lib/libGL.so.1.2 lrwxrwxrwx 1 root root 15 Aug 23 14:02 /usr/lib/libGLw.so.1 -> libGLw.so.1.0.0 -rwxr-xr-x 1 root root 20700 Jan 14 2012 /usr/lib/libGLw.so.1.0.0
All “missing library” errors should be resolved by now but sound still does not work with the following warning displayed during emulator-x86 startup:
> /usr/local/android-sdk-linux/tools/emulator-x86 -avd Android_x86 emulator: warning: opening audio output failed
The problem is in missing 32-bit ALSA API to access a PulseAudio sound daemon. Just install alsa-plugins-pulseaudio.i686 to fix the sound problem with Android emulator:
> yum install alsa-plugins-pulseaudio.i686
As you can read, on 64-bit Linux all problems with emulator (or other tools from Andorid SDK) are related to missing 32-bit libraries. The reason is simple, SDK is 32-bit software and newer Linux systems that are certainly 64-bit should have installed i386 / i686 libraries.
Hope this tutorial will help you to run Android SDK tools without any errors.
13 thoughts on “Android emulator on Fedora Linux”
Thanks for the info!!
Awesome. Wouldn’t it be nice to see up to date help like this on the android site.
When I execute:
the console said : Dont exist the package.
And also,I don’t have these OpenGLES libraries.
Do you know how solve the problem?
@David – Maybe you have misspelled some package name because when I type in yum command as root user here is my output:
OpenGLES libraries are included in Android SDK so you only need to set correct path in android.conf file.
The same error as a root.
Nada para hacer
It’s in Spanish…Don’t exist any packet available glibc.i686.
Is your Linux a 64-bit? If the following command doesn’t print x86_64 then your have 32-bit OS:
So in case of 32-bit Linux you don’t have to install 32-bit support. Here is described similar problem that might be helpful:
Amazing, well done and thanks.
I struggled a lot with this, I got an error that the emulator couldn’t load the i965 driver which I think is the intel hd 4000.
After a lot of fiddling i think the solution was to add add this 32 bit packages also: mesa-dri.drivers
I have tried everything and still no luck. I think I installed the android-sdk-linux and the adt-bundle-linux-x86_64-20130917 that may be confusing the issue :-O I removed the android-sdk-linux and still have problems. Coud there be some residual stuff that I need to remove?
yum install mesa-libGLw
solved my problem on a 32-bit fedora installation
yum whatprovides */libOpenglRender.so
gave me a 404 error …
It seems that the most problems come from missing 32bit packages on 64bit Linux installation. If you know how to locate and install this packages, you’ll be able to resolve the issue.
Anyway, thanks for your feedback.
Why not emulator64-x86? Since we are x86_64 arch why use emulator-x86?