Android emulator on Ubuntu 10.04 in 60 seconds.

Printer-friendly versionPrinter-friendly version

So what's happening here?

What's happening here is the step-by-step instructions for how to install the Android emulator on Ubuntu 10.04 in 60 seconds (admittedly not including the ridiculous time it takes to download the various Android platforms you want to support). And so, without further ado, let's get to work.

Java? Java!

Unsurprisingly, you'll need Java and, as far as I can tell, the standard OpenJDK implementation should work just fine, but I'm willing to be corrected:

$ sudo apt-get install openjdk-6-jdk

Once that's installed, you might want to verify that it seems to work:

$ java -version
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8) (6b18-1.8-4ubuntu3)
OpenJDK 64-Bit Server VM (build 16.0-b13, mixed mode)
$

Looks good. Moving on ...

Downloading the Android SDK

Grab the latest Android SDK tarball from here, and install it somewhere under your home directory. Once you do that, you should add the newly-installed tools/ subdirectory to your search path, since you're going to want to be running the android and emulator executables real soon now. Once you do that, naturally, log out and log back in to make sure you have the updated search path.

And now, the real downloading starts.

Adding the SDK components

At this point, you need to download and install the SDK components for whatever versions of Android you want to support. Initially, you can tell that you have no SDK versions downloaded:

$ android list
Available Android targets:
Available Android Virtual Devices:
$

So what you need to do is run the following, and select whatever versions of the SDK you're going to need. Unless you're being frugal, just select everything since you never know if you'll need to support older versions:

$ android update sdk

Depending on your download speed, take a break. Once the entire download is done, you can verify that it's all there with:

$ android list
Available Android targets:
id: 1 or "android-2"
     Name: Android 1.1
     Type: Platform
     API level: 2
     Revision: 1
     Skins: HVGA-P, QVGA-P, HVGA (default), QVGA-L, HVGA-L
id: 2 or "android-3"
     Name: Android 1.5
     Type: Platform
     API level: 3
     Revision: 4
     Skins: HVGA-P, QVGA-P, HVGA (default), QVGA-L, HVGA-L
id: 3 or "android-4"
     Name: Android 1.6
     Type: Platform
     API level: 4
     Revision: 3
     Skins: HVGA (default), WVGA854, WVGA800, QVGA
id: 4 or "android-5"
     Name: Android 2.0
     Type: Platform
     API level: 5
     Revision: 1
     Skins: HVGA (default), WVGA854, WVGA800, WQVGA400, WQVGA432, QVGA
id: 5 or "android-6"
     Name: Android 2.0.1
     Type: Platform
     API level: 6
     Revision: 1
     Skins: HVGA (default), WVGA854, WVGA800, WQVGA400, WQVGA432, QVGA
id: 6 or "android-7"
     Name: Android 2.1-update1
     Type: Platform
     API level: 7
     Revision: 2
     Skins: HVGA (default), WVGA854, WVGA800, WQVGA400, WQVGA432, QVGA
id: 7 or "android-8"
     Name: Android 2.2
     Type: Platform
     API level: 8
     Revision: 2
     Skins: HVGA (default), WVGA854, WVGA800, WQVGA400, WQVGA432, QVGA
Available Android Virtual Devices:
$

So that tells us that we have support for various versions of Android, but no virtual devices yet. No problem. Time to create some virtual devices.

Creating a virtual device or two

A fairly simple procedure:

$ android

Select "New," give your new Android Virtual Device (AVD) a name and so on, but there's one caution -- apparently, there's still a bug (reported by your humble author) that you can't select an SD card image of size 2G or larger so just pick something smaller. Once that appears to be done, close the window and verify you have a new AVD (given some values I pulled out of thin air):

$ android list avds
Available Android Virtual Devices:
    Name: avd2.2
    Path: /home/rpjday/.android/avd/avd2.2.avd
  Target: Android 2.2 (API level 8)
    Skin: HVGA
  Sdcard: 1024M
$

Run that baby!

$ emulator @avd2.2

Note that, the first time you run the emulator on a new AVD, it might take a while so be patient. And now, the fun part -- installing a new app.

Installing a new app on your emulator

A detailed explanation of how to install a new Android app can be found here, but let's keep it short. Assuming you have your new app in .apk file format, simply make sure your emulator is running:

$ adb devices
List of devices attached 
emulator-5554	device
$

at which point, install the app with:

$ adb install [.apk filename here]

whereupon the icon for your new app should show up in the emulator.

Comments? Questions?

Comments

couple of basic questions for a newbie

Hi,

Where do you get these apk app packages?

Also, I want to test html5 mobile apps. Is one of these sdk's I downloaded good for a phone size avd?

Thanks

emulator cannot be stopped, only killed

I wonder if somebody faced an issue when after clicking emulator's x-button it becomes frozen (while there is some disk activity) and never exits. Restarting Ubuntu in this situation never ends either. But it is possible to kill the process and this somehow helps. Thanks.

Great article

Great article on android sdk and emulator installation!
Although, the link to download the sdk seems to be broken. Here is the good link page: http://developer.android.com/sdk/index.html

Time to update

This article is definitely getting dated, so I think I'll update it in the next few days. Check back then for a current writeup.

not dated, it's still exactly

not dated, it's still exactly the same way as odd as it may sounds.

We know

We're aware of the time and budget pressures at most companies, normally accompanied by the plaintive cry from management of, "Yes, I know we need training on that topic, but I just can't afford to send my entire team away for three (or four or five) days to get it!" And that's where we come in.

Choices!

The main focus at Crashcourse is to offer a choice of intense, 1-day, hands-on courses on specific topics in Linux and open source. And given that we already have the laptops for the delivery of that training, the idea is to show up early, set up a classroom, then spend the day teaching exactly the topic you're interested in. No travel time, and no wasted classroom time.

Customization

If we don't already have a course that addresses the topic you're interested in, drop us a note and we'll see what we can do -- our content providers can almost certainly put together a course that's precisely what you're after.

The difference

While there are a variety of sources for Linux and open source training, we at Crashcourse are taking a slightly different approach. Our philosophy is simple: exactly the training you want, and no wasted time or travel to get it.