Monday, May 13, 2013
How to install/run Android emulator on Ubuntu or Debian
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.
Have a Happy Droiding!