This article will guide you through the necessary steps to install an Android emulator on Ubuntu in order to test the Android platform. I have tested this on Ubuntu 10.04 - 11.10 but it might work on versions prior to 10.04 as well.
We should start by downloading the Android SDK. I usually put every app/script I create on a dev folder inside my home directory so this is where I tend to download the Android SDK. You can of course choose another folder to download it to. Open terminal and execute following commands
While downloading the Android SDK, open up a new terminal tab/window and install the requirements
sudo apt-get install openjdk-6-jre
If you are on a 64bit system you might also need to install ia32-libs.
sudo apt-get install ia32-libs
When the Android SDK download has finished, extract the archive either by right-clicking on it and pressing "extract here" or by executing following command in terminal
tar -xvf android-sdk_r12-linux_x86.tgz
Enter the extracted folder, then enter the tools folder, then double click on the android file and choose "run" when asked what to do.
You could also do all this in terminal if you would like to.
Android SDK and AVD Manager interface will now appear.
Now select "Installed packages" in the list on the the left, and press "Update All...".
A new window will now appear with a list of Android SDK Platforms. Click on "Accept All" radio-button and press "Install".
When the installation has finished, press "Yes" when you are asked to restart the AVD.
Now it's finally time to create a virtual device. Select "Virtual devices" in the list on the left, and press "New..."
A new window with a bunch of options will now appear.
The required options here are "Name" and "Target". One may add a virtual SD Card by entering the size and also extra hardware such as GPS and keyboard, by pressing "New" on the "Hardware"-field. As you can see on the image above, I have only entered a name and a target.
Target: Android 2.2 - API Level 8
If you want to run an application designed for older Android devices, or if you want to create an application to be supported by older Android devices, you might want to select Android 1.5 or 1.6 as your target.
When you are finished with the options, just press "Create AVD". A new window will now appear telling you the results.
Press the "OK" button and in the list with virtual devices, select the newly created device and press "Start".
A new window will now appear, just press "Launch".
Since it's the first time you run the emulator, it might take some time to start and load the Android OS.
Now that the Android emulator is running, you might want to create a launcher for easy access. Right click on your Desktop, or somewhere where you want the launcher to be created, and select "Create Launcher...". A window with options will appear.
Now remember the path where you first downloaded the Android SDK, because you will need it for the launcher. I entered following values
Name: Android Emulator
Command: /home/antonis/Dev/android-sdk-linux_86/tools/emulator @AVDName
Remember to set the path according to your choices and enter the right @name depending on how you named your AVD. You could also add an icon by clicking on the top left image-button and selecting your icon.
I have also created two symlinks to android and adb so that I can execute them from terminal without having to enter the path all the time! To do so, create a folder called "bin" in your home directory (in my case /home/antonis/bin) and add two symlinks as shown below:
ln -s /home/antonis/Dev/android-sdk-linux_x86/tools/android android
ln -s /home/antonis/Dev/android-sdk-linux_x86/platform-tools/adb adb
You have to log out and then log in again in order for the changes to take place. (PS. you don't have to log out and back in if you already got a "bin" folder in your home directory)
Now to install applications/games on the Android emulator you will have to upload the .apk files somewhere on the web and download them through the Android browser or by executing following command in terminal while the emulator is running.
adb -e install -r yourapp.apk
The -e option specifies that you are using an emulator in case an android device is also connected to the computer
The -r option will replace the application if already installed
Your are now all set up and ready to enjoy the incredible world of Android! There will also follow a guide on how to set up Eclipse for writing Android applications.