How to run Android Market on the Emulator

During development, it is often useful to be able to test the Android Market from a device other than your own. However, by default the Android emulator doesn’t include the Android Market – nor offer an easy method of installing it. This tutorial will show you how to setup an Android Virtual Device (AVD) running Android 1.6 and the Market application.

Getting Started
This tutorial assumes you have the Android SDK installed and functioning, and have downloaded at least the basic Android 1.6 target. If not, complete these steps before continuing.

First, you’ll need to download the Android 1.6 system image file from http://www.4shared.com/file/165624746/fc72c3ed/system.html (this can also be found on the HTC website – look for Android Dev Phone 1). This is close to 60MB, so it might take a while to download.

While you’re waiting, start the Android SDK and AVD Manager, and create a new virtual device. Choose whatever name you like, and set the target as “Android 1.6”. I recommend selecting a 2GB SD card, and booting up the virtual device just to test and make sure it runs correctly.

Replacing the System Image
Now find the folder where your Android 1.6 system image is stored (not the folder for your AVD). Under Linux this will be <android-sdk-folder>/platforms/android-1.6/images/. Notice there is a system.img file in this folder. Copy this to a backup location, and paste in the file you just downloaded. This replaces the default Android 1.6 virtual machine with our new custom image, which includes the Android Market pre-installed.

Setting up the device
Using the AVD Manager to start up the virtual device. If all goes well, it will boot directly into Android, and let you choose to setup the device. Click through the tutorial, and when given the option to enter your Google account, choose “Skip“. We’ll complete that part later*. Finish the wizard.

Now you should see the home screen. Click the grey arrow at the bottom of the screen, and find the Android Market icon. Click to launch it.

Now you can fill in your Google account details. Use a different account than you have on your primary device (you might like to create one specifically for testing Android apps). Accept the terms and conditions, and you should be able to browse and download applications just like on a physical Android device!

Note: The Android Market will automatically update itself some time after linking to your Google Account. Don’t be surprised if it suddenly closes without warning – just wait a while and start it up again to continue downloading apps.

* When I tried to complete the initial setup wizard, I got stuck at a screen saying “slide out your keyboard to continue”. By skipping this step, and setting up the Google account later on I was able to avoid the issue.

Other resources:
http://www.howtogeek.com/howto/21862/how-to-enable-the-android-market-in-the-google-android-emulator/
http://techdroid.kbeanie.com/2009/11/android-market-on-emulator.html