Android emulator on Fedora Linux

More...

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:

> ldconfig

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.

This entry was posted on August 27, 2012 and is filed under Android

Related posts

12 Responses to Android emulator on Fedora Linux

  1. miguel says:

    Thanks for the info!!

  2. umar says:

    superb

  3. Erik Whitehead says:

    Awesome. Wouldn't it be nice to see up to date help like this on the android site.

  4. David says:

    When I execute:

    > yum install glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i686
    

    the console said : Dont exist the package.
    And also,I don't have these OpenGLES libraries.
    Do you know how solve the problem?
    Thanks!

  5. dbunic says:

    @David - Maybe you have misspelled some package name because when I type in yum command as root user here is my output:

    root# yum install glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i686
    Loaded plugins: langpacks, presto, refresh-packagekit
    Package glibc-2.15-57.fc17.i686 already installed and latest version
    Package libstdc++-4.7.2-2.fc17.i686 already installed and latest version
    Resolving Dependencies
    --> Running transaction check
    ---> Package glibc-devel.i686 0:2.15-57.fc17 will be installed
    ---> Package libX11-devel.i686 0:1.5.0-2.fc17 will be installed
    ---> Package libXrandr.i686 0:1.3.1-3.fc17 will be installed
    ---> Package libXrender.i686 0:0.9.7-1.fc17 will be installed
    ---> Package ncurses-devel.i686 0:5.9-4.20120204.fc17 will be installed
    ---> Package zlib-devel.i686 0:1.2.5-7.fc17 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ====================================================
     Package       Arch   Version       Repository  Size
    ====================================================
    Installing:
     glibc-devel   i686 2.15-57.fc17       updates 991 k
     libX11-devel  i686 1.5.0-2.fc17       updates 1.0 M
     libXrandr     i686 1.3.1-3.fc17        fedora  33 k
     libXrender    i686 0.9.7-1.fc17        fedora  30 k
     ncurses-devel i686 5.9-4.20120204.fc17 fedora 705 k
     zlib-devel    i686 1.2.5-7.fc17       updates  46 k
    
    Transaction Summary
    ====================================================
    Install  6 Packages
    
    Total download size: 2.8 M
    Installed size: 4.4 M
    Is this ok [y/N]:
    

    OpenGLES libraries are included in Android SDK so you only need to set correct path in android.conf file.

  6. David says:

    The same error as a root.

    root@david-Satellite-L500:/home/david# yum install glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i686
    Configurando el proceso de instalación
    No existe disponible ningún paquete glibc.i686.
    No existe disponible ningún paquete glibc-devel.i686.
    No existe disponible ningún paquete libstdc++.i686.
    No existe disponible ningún paquete zlib-devel.i686.
    No existe disponible ningún paquete ncurses-devel.i686.
    No existe disponible ningún paquete libX11-devel.i686.
    No existe disponible ningún paquete libXrender.i686.
    No existe disponible ningún paquete libXrandr.i686.
    

    Nada para hacer
    It's in Spanish...Don't exist any packet available glibc.i686.

  7. dbunic says:

    Is your Linux a 64-bit? If the following command doesn't print x86_64 then your have 32-bit OS:

    > uname -i
    x86_64
    

    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:

    http://stackoverflow.com/questions/5595110/android-fedora-installing-32-bit-packages

  8. Tyson says:

    Amazing, well done and thanks.

  9. Perty says:

    Hi,

    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

    phew...

  10. DanW says:

    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?

  11. LutzL says:

    Many thanks,

    yum install mesa-libGLw

    solved my problem on a 32-bit fedora installation

    yum whatprovides */libOpenglRender.so

    gave me a 404 error ...

  12. dbunic says:

    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.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

In case of posting HTML tags or JavaScript code please convert special characters to HTML entities.
Especially pay attention to convert "<" character to "&lt;" entity!