How to run Android emulator on Ubuntu or Debian

As the name implies, Android emulator enables you to test-run Android apps on non-Android devices or computers running the emulator.

Here is guide on how to run Android emulator on Ubuntu or Debian.

Android emulator comes with Android SDK, and therefore you need to install Android SDK. Follow the steps below to install Android SDK on Linux.

Android SDK requires Java JDK. Therefore install Java JDK first.

To install Java JDK on Ubuntu or Debian:

$ sudo apt-get install openjdk-7-jdk

To install Java JDK on CentOS, Fedora or RHEL, first set up Repoforge repository on your system, and then run the following.

$ sudo yum install java-1.7.0-openjdk-devel

Now download Android SDK ADT bundle from Android official site. Unzip the downloaded ADT bundle, and copy the sdk directory to your preferred location. Here I assume that the installation directory of Android SDK is ~/android-sdks.

For 64-bit Linux user: you must install another prerequisite called ia32-libs since Android emulator is 32-bit software. The ia32-libs package contains a set of runtime libraries for the ia32/i386 architecture, configured for use on a 64-bit kernel. On 64-bit Linux, the mksdcard utility which creates SD cards will fail without this package.

$ sudo apt-get install ia32-libs

While using ia32-libs, if you encounter any error with 32-bit libGL.so, do the following:

$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2.0 /usr/lib/libGL.so

In order to run Android emulator, you first need to create a new AVD (Android Virtual Device) which is an emulator configuration for the Android device to be emulated. To create a new AVD, first launch Android SDK Manager by running the following.

$ ~/android-sdks/tools/android

Go to "Tools" > "Manage AVDs" on Android SDK Manager's menu. It will open up AVD Manager.

Click on "Add" button to create a new AVD. An example configuration of a new AVD is shown below.

If an AVD has been successfully created, you will see the following confirmation.

You can check the list of available AVDs as follows.

$ ~/android-sdk/android list avds
Available Android Virtual Devices:
    Name: my_avd
    Path: /home/xmodulo/.android/avd/my_avd.avd
  Target: Android 4.2 (API level 17)
     ABI: armeabi-v7a
    Skin: 800x1280
  Sdcard: 1G

To launch Android emulator with the AVD that you have created, highlight the AVD on AVD Manager, and click on "Start" button on the right sidebar.

Alternatively, you can start Android emulator directly from command line as follows. In this case, specify "@[your_avd_name]" as an argument to the emulator.

$ emulator @my_avd

Booting up Android emulator may be slow (even taking minutes) depending on your hardware. Once Android emulator is successfully launched, you will see an running instance of Android device.

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.


Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of Xmodulo.com. He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

18 thoughts on “How to run Android emulator on Ubuntu or Debian

  1. Hi Dan Nanni,

    To improve your howto, please add the following since a clean ubuntu install won't have this package!

    sudo apt-get install openjdk-7-jdk

    This fixed the error when running "~/adt-bundle-linux-x86_64-20130219/sdk/tools/android": java: not found:

    • Thanks for your comment. You are right. In the original post, I did not go into the details on installing Android SDK. I updated the post to include instructions on how to install Android SDK.

  2. You might also add that running the emulator is "slow" and "booting" the avd can take a couple of minutes easily while it hangs on the android screen.

  3. Thanks for your manual.
    I am not familiar with segfault. Is there a solution for the message I get?
    Andoid SDK manager starts up and can add a new AVD in Device Manager.
    When I start the AVD, segfault occurs with no emulator screen.
    On Ubuntu 12.04.2 LTS:
    kernel: [15891.120233] emulator-arm[12235]: segfault at 10 ip b6f2f294 sp b55921b0 error 4 in libGL.so.173.14.36[b6ee5000+88000].

    • Are you using 64-bit machine? If so, there are some known issues with Android emulator producing segmentation faults due its poor support for OpenGLES on x86_64. Try 32-bit machine or use different versions of SDK (e.g., version 16).

  4. I am not that familiar with the specs. Could this be a (not) working combination?

    Linux desktop 3.5.0-34-generic #55~precise1-Ubuntu SMP Fri Jun 7 16:32:06 UTC 2013 i686 i686 i386 GNU/Linux.
    java version "1.6.0_27"
    OpenJDK Runtime Environment (IcedTea6 1.12.5) (6b27-1.12.5-0ubuntu0.12.04.1)
    OpenJDK Server VM (build 20.0-b12, mixed mode)

  5. My emulator starts but it shows a blank screen with keys on the side. Can anyone tell why it is happening?

  6. My emulator won't even start. I get a dialogue with "starting emulator for AVD 'Testing'" with a progress bar. The progress bar reaches 100%, and then after a short delay, the dialogue disappears. An emulator64-arm process is left running at 100% CPU and 1.4% memory, apparently doing nothing. No emulator window is shown.

    Output when run manually: http://paste.debian.net/37622/

  7. Any chance you can add a piece to make the avd available remotely? With resource and performance issues on win7 dev machine I've moved the avd off to my linux machine. Thanks to this, got it up and running, but setting up linux to allow connections to the avd from another computer on the network is somewhat confusing....

  8. in the avd creating window, i can't select a target. As a result of that i can't create an avd. Can u help me?

    • Hey, first you should click on the android sdk manager -
      the icon is on the left side of the adv-manager.

      There you can choose the android-version you want to simulate. When download is ready,
      it should be available in the sdk manager.

    • Go and install the version of the API you want. Maybe if it 2.3.3 check all the packages under that version and click on install. Make sure your internet connection is working well. it might take time.

Leave a comment

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