Monday, November 22, 2010

[How to] Install Android market on Emulator


VComment[How to] Install Android market on Emulator         
          
Android Emulator is a virtual mobile that is packaged along with the Android SDK. It runs on your computer and can be used to prototype, develop and test applications without having to buy a physical device. Almost all of the hardware and software features of a typical mobile device are mimicked in the Android emulator. However, if you want to try out some apps from the Android market, you can’t do that with the emulator as it does not include ‘Android market’. Here is a step-by-step guide to enable Android market in the emulator.
Steps to enable Android market in the emulator
1. Download and install the latest Android SDK (Android 2.2, API 8, revision 2) from here. This comes up with all the tools needed for development and testing of your application. Make sure the driver ‘ADB interface’ is installed on your machine. In most of the cases, the driver will be installed directly once you plug-in the device. [The SDK installation location will be referred to as SDK_LOCATION in the rest of the article]
Android SDK Setup2. Next step is to create a Android Virtual Device. Select ‘Virtual Devices’ from the left pane of the Android SDK and AVD Manager. Create a new virtual device with the details mentioned in the screenshot below. The screen might be frozen for few minutes while the virtual device is being created. Android Virtual DevicesAndroid Virtual Device3. After the device is created, go to the location ‘%userprofile%/.android/avd’. You will find a folder named ‘DemoDevice.avd’. Copy the system image ‘system,img’ from ‘SDK_LOCATION/platforms/android-8/images’ to the folder 'DemoDevices.avd’.
4. Start the emulator specifying the partition size. From cmd: emulator –avd DemoDevice –partition-size 100. (100 MB will be allotted for user space). Emulator opens up and it looks like the one below. Note: If the command emulator is not recognized, add SDK_LOCATION/tools to the PATH variable.
Android Emulator 5. From cmd, execute ‘adb pull /system/build.prop .’. This will copy the file build.prop to your current working directory. Open it with your favorite text editor and change the property ‘ro.config.nocheckin=yes’. This is needed to fix the freezing of market downloads. Related article.
6. Now, we have to push back the modified build.prop. This is not as easy as pulling it out. First, you have to mount the /system partition in read-write mode. Check out this to know how to do that. After the partition is remounted, execute the adb push command to push back the build.prop ‘adb push build.prop /system/.
7. The next thing is to install the Market application. Download ‘Vending.apk’ from this thread. Google Services framework is a pre-requisite for Android market. To get ‘GoogleServicesFramework.apk’, download upload.zip from here and extract the zip to find the .apk file inside /system/app. Download 'GoogleServcesFramework.apk' from here. Push both these .apk to the device. ‘adb push Vending.apk /system/app/.’ ‘adb push GoogleServicesFramework.apk /system/app/.’. Also, delete the  SdkSetup.apk from the device. ‘adb shell rm /system/app/SdkSetup.apk’. Make sure the SdkSetup.apk is deleted otherwise the emulator will be reverted back to its original stage.
8. Close the emulator. Delete the images userdata.img, userdata-qemu.img and cache.img from ‘%userprofile%/.android/avd/DemoDevice.avd’. Start the emulator again from Android SDK and AVD Manager. Android Market will be available on the emulator now. On opening the market, you will be prompted to connect with your Google account. Connect with your Google account and install your favorite apps on the emulator.
Android emulator with Android MarketConnecting to Android market with Google AccountAndroid Market Terms of ServiceTop free games on Android marketSolitaire installed from Android Market
Note: Installation of apps from Android market seems to be very slow in the emulator. Market app crashed couple of times before I get the chance to install the apps. Also, I could not find the most popular Android game ‘Angry Birds’ in the market. Installing the same from its .apk didn’t work either. I am trying to tweak the emulator to make it work smoothly with Android Market. If you have any tips for the same, please post them as comments here.
Update: Uttam Hoode has tried this approach with Android 2.3 SDK and it worked fine.
-- Varun

91 Responses to “[How to] Install Android market on Emulator”

Marko Stamcar said...

Thanks, it works well! Even Angry Birds ;-)

Varun said...

Thanks Marko! Did you add any other config entry to make it working??

Marko said...

Actually, I spoke to soon... I got Angry Birds to install, but when they run, the graphics is missing, however the theme music can be heard. Perhaps the Lite version promised will work better. Also, I did not change anything else, just followed your tutorial.

Varun said...

Yup! The same happened with me. Looks like its a problem with the application itself. The application is not positioning the graphical contents properly. Guess, its including the virtual keyboard space as well for positioning.

Anonymous said...

did that a year ago in an easier way

1. download sdk
2. download adp1 android image
http://developer.htc.com/adp.html
3. replace the system image from the emulator with the one from adp1
4. start the emulator

Anonymous said...

Angry Birds requires OpenGL ES 2.0 and the emulator doesn't support that ;)

anurag dalia said...

hey varun ..this is anurag from hyderabad,india and i am a developer and when i tries pushing build.prop it gave this error

failed to copy 'build.prop' to '/system//build.prop': Out of memory

Varun said...

Hi Anurag, you have to start the emulator by setting the -partition-size option. check out step#4.

Anonymous said...

Wanna know if Market can be installed on a mobile without a market application the same way ???
I mean pushing Vending.apk & GoogleServicesFramework.apk to /system/app ???
Thanx
Kian

Varun said...

Hi Kian,

You can do that if you have root access to your device.

Varun

Replying to Anonymous, sure, maybe that works - nice solution. However, it seems like only up to 1.6 is available at the HTC site, while the current emulator is 2.2.

Ninad said...

Hi there,

my question to you guys i am using a proxy network, any solution to it to connect it to internet. i have tried login -http-proxy, also tries pushing the ip address settings in apn setup of emulator. but still browser not working for me. can you help me in this regard?

thnks in advance,

Ninad

Anonymous said...

Hi again
I have root access on my galaxy S
but I don't know how to do that?
I leave in an area with no access to Market. what is the procedure if you don't mind ? same as emulator ? what about deletion of img files ?
Kian

Disintegrator said...

I am sorry but I am fairly new to this, when you say:

4. Start the emulator specifying the partition size. From cmd: emulator –avd DemoDevice –partition-size 100. (100 MB will be allotted for user space). Emulator etc...

how do i do this? where do i navigate my CMD to? ... or am i not understanding something?

Varun said...

Kian, I have not tried the technique on any physical device. Theoretically, it should work on devices as well. You can ignore the steps which involve emulator specific steps like images, partiion-size, etc. Disclaimer: I am not responsible if your phone is screwed trying this. :)

Varun said...

@DisIntegrator: Open command prompt by pressing Win + R. Or, Start Menu > Run. From the command prompt, execute the command given in Step#4. 'emulator' command will be recognized only if you have added Android SDK path to your windows path variable.

Mylifeasacomic said...

Hello!

I can't believe I'm not the only one who's thought of this :)

I started a thread here (http://forum.tabletpcreview.com/software/35776-anyone-got-android-x86-working.html) about getting the emulator to work.

Just like you, the market and google apps work, but many of the apps don't work :(

Angry birds loaded for me, but the placement of the contents seems wrong, but I can here the music!

Anonymous said...

tnx work well

Scott said...

First a tip. By using the command "adb remount" it seems to allow read/write access to an AVD without all of the extra steps in the link you have.

I have tried this process several times (based on your instructions here and an alternate set I found at: http://anythingsimple.blogspot.com/2010/09/how-to-use-android-market-on-android.html)

However I continue to have TWO main problems

1) I can't find many apps on the market. Not that I care to instal it on this AVD but for example Angry Birds is not found even though some comments indicate they were able to locate and install it (albeit with limited success). I specifically want to use the AVD to share out for a training class so I can show some people unfamiliar with Android exactly how to install a certain app from the Android Market. At this point I can't seem to find many apps at all. Not sure what the trick is here. I used the versions of Vending.apk and GoogleServicesFramework.apk that you suggested in your tutorial. Could this have anything to do with where in the world I am located (United States)?

2) Whenever I create an AVD with these instructions the HOME button on the AVD screen (next to the on screen keyboard) ceases to function. The home button works fine for all my other AVD's but as soon as I build a new AVD to get the market working and go through this process, the HOME button stops working. Anyone else seen this or have a suggestion?

Thanks in advance for any help

uttam hoode said...

Tried this with Android 2.3 SDK. It works fine.

Mario said...

the instructions worked well on Ubuntu Linux as well. I'm running Android 2.3

thanks!

runeks said...

I have the same problem as Scott, some apps I simply can't find. Going into Games and "All Games" and doing a search for "angry birds" returns no results. If I search for only "angry" I get three results:

Rimshot (by Angry Hacker)
Better Deal (by Angry hacker)
iSwear (by Reign-Design)

Does anyone know why this is the case? I live in Denmark, but I know someone who has a HTC Desire here who has Angry Birds on his phone.

jl said...

For those of you who are missing many apps in Market, the so-called "Market fix" that works on other Android devices seems to work on emulator. You can google "market fix android", and find info, including Youtube videos. The basic steps are:

- Go to Settings ==> Applications ==> Running Applications
- Find Market, click on that, then clear Cache, then Force Stop
- Find Google Framework Services, click on that, then clear DATA, then Force Stop
- Start the Market app. You SHOULD get an error popup. If you don't then do the clear/force stops again.
- When you get the popup error, click OK
- Wait a few seconds
- Kill the emulator
- Start the emulator
- Start the Market app. Now, you should see "most" of the apps in the Market, including, e.g., Angry Birds.

The above fix doesn't seem to let you see 100% of the apps in the Market. There seem to be many attempts to get more, mostly involving changing the "fingerprint" parameter in the /system/build.prop, but while that gets you more apps, still not 100% I think.

Anonymous said...

Hi, I followed the every steps fine, and at the end, I saw the Vending.apk and Google..apk in /system/app/. and I rm the sdksetup.apk as well. But when I closed the emulator, rm user files in avd, and restarted as you said from sdk manager, all the changes has lost, so I'm back to squre one. I use windows xp and android 2.3. I repeated and got the same thing. I'm sure I removed SdkSetup.apk and double checked in /system/app/.

What should I do now?

Anonymous said...

I must have missed something. I have followed your steps exactlly. But I could not get the Vending.apk and GoogleFramework.apk in my virtual device. I double checked that I deleted SdkSetup.apk and removed all the user files in avd directory. Then I restarted the avd, but Vending.apk and Googleframework.apk are gone.

I run android 2.3 in windows xp. Did I miss anything?

Anonymous said...

Dear Varun,

I have followed your steps and finally got the Vending.apk and GoogleServicesFramework.apk in /system/app/ (and no SdkSetup.apk. However, the market application did not show up. I must have missed something. I have tried both 2.2 and 2.3. I use windows xp.

Thanks,
Jun

Anonymous said...

Thanks, I finnaly got it in emulator. I use 2.3 and windows xp. The problem earlier was the Vending.apk from the pointer in your post did not work for me. I used the Vending.apk from the same package of the GoogleServicesFramework.apk, then magic occurs...

Venkat said...

Open it with your favorite text editor and change the property ‘ro.config.nocheckin=yes’.

While performing this step the value of ro.config.nocheckin in the build.prop is already set to yes. Also when I tried it wouldnt work properly with Market taking for ever to search even the most common apps but never would return results. Is it something to do with the market app upgrade??

Anonymous said...

Yesterday, I finally got market in my emulator on windows xp. But it was too early to claim victory. It somehow broke the network connection (sigh, windows...) So I got a chance to try it today with Ubuntu, android 2.3 and it works out perfectly. Thank you.

Anonymous said...

Many thanks to jl on Market fix...

Anonymous said...

everything seems fine, except that no downloading is happening at all. Should "ro.config.nocheckin" be set to 1?

Anonymous said...

Many thanks - this is awesome.

However, after doing this, the Home button no longer works on the Emulator.

velu said...

step #6 (to mount the /system partition in read-write mode) , "adb remount" makes the /sysem partion read wite. my abd version 1.0.26

Anonymous said...

Do you why the downloading never start?

Thanks,

GIOVANNI said...

Is there a way to install an Android app (apk file) directly onto a GalaxyTab via a USB connection from a notebook where the Emulator is running, i.e. without having to access any Android site (like AppInventor) or Samsung first?

My objective would be to be able to develop and test applications, in the simplest possible way, for database SQlite3 creation and usage before submitting them to Android or Samsung.

Thanks and best regards

Giovanni

Varun said...

Giovanni, You can use 'adb install' to install the application -- http://developer.android.com/guide/developing/tools/adb.html#move

Varun

Anonymous said...

I was never able to update build.prop, even using system.img (which runs very slowly and kills my Home button). I made a batch file to automate the whole process, and 30 seconds into the first launch of the emulator, I push the file over before the system locks it down.

START /B emulator.exe -partition-size 100 -memory 1024 -no-audio -no-boot-anim -avd Ginger -scale .78

TIMEOUT /T 30
ECHO.
ECHO Install new fingerprint before the system is up

adb -e shell mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
adb push build.prop /system
adb remount

Not sure the r/w mount is even necessary

GIOVANNI said...

Hello, thanks, great Varun!

I had read the adb several times but always without detecting the adb "install" command and associated details!

This seems to demonstrate that, among other capabilities, to be able to understand the immense complexities of the Android platform and components, one should also have sharp eyes and clean glasses!

I'll let you know the results of my tests, some time, hopefully in the near future.

Giovanni

trm96 said...

In step 5-7 I assume you are running the commands from within android but how do you run the commands? Every time i try to run the commands it says "adb: permission denied". I have tried using su as well as sudo to run the commands but it wont allow me to run either.

Asif said...

I am getting one error that is connect to wifi whereas I am using it via emulator. So how can I resolve this, that is network connection is not coming into play.

Anonymous said...

why don't you just share the "system.img" file pls?

Anonymous said...

I have installed google market by following above mentioned steps and got market on my emulator. Unfortunately, when I start market, on adding the google account i got this error:

Can't establish a reliable data connection to the server. This could be a temporary problem or your phone may not be provisioned for data services.

Ravi said...

Varun, could you please upload your image of the emulator? This would save a lot of time. Many thanks.

Hi, I followed every step and everything semt to go correctly.
However, when I open Market and try download any app, I get a "starting download" that stalls forever.
The same problem I have on my Chinese device, and also when I tried with the HTC 1.5 emulator as stated in another fix post.
I start to wonder if it could have to do with my Wifi connection (but it worked there on my Chinese device long ago!?)
Also, I cheched my build.prop and it already has the correct ‘ro.config.nocheckin=yes
Anyt suggestion? I am desperate to get this work!

Harish said...

Varun.. Thanks a Bunch.. It worked like a charm..

cy said...

Thanks so much, It worked

Anonymous said...

You rock man..... it works great

Anonymous said...

i cant see the market in the applications and i have done all the steps

Anonymous said...

rzroms.com has disappeared, WHOIS says the domain expired in March. Is there another place to get the update.zip or at least the Google Services Framework .apk?

Anonymous said...

I got the "GoogleServicesFramework.apk" from my Nexus S (pulled it out and pushed it to the emulator). try it - its great :P

Prash said...

Hi Varun

I have followed till step number 3.
When I tryp step#4, the error message i get is
Hint: use '@foo' to launch a virtual device named 'foo'.
please use -help for more information..I have tried many things including deleting my avd and creating a new one...The android versioj I am using is 2.2 Google APIs...Can u suggest something...
Thanks in advance

Anonymous said...

This tut needs an update. The "GoogleServicesFramework.apk" link is dead. Instructions should be a little clearer, as the steps to pull / push files using adb is not so complicated. You are just making is look like it is rocket science.

Anonymous said...

I do everything ok, but when I restart the emulator, there is no market, ....., help I need?

Emerald214 said...

^ me too, I did everything, even remove SdkSetup.apk but when I restart emu, the market was gone.

Android 2.2

Anonymous said...

THe same for me.
Market is isntalled, but it does not start.
It flashes a white page and then it closes.

Anonymous said...

Thanks a ton

M4rketSqueezer said...

Hey Varun, is it the original version of GSF or a patched one?
Would be happy if you read my post at xda-dev!
http://forum.xda-developers.com/showthread.php?t=1149807

sos987 said...

Doesn't work for me.
Before reboot Market seems to be installed but I couldn't sign in to Google, when trying.
After reboot there is no Market available in the apps menu.
Removing SdkSetup.apk doesn't help.

Aakash said...

facing same problem as sos987..

Chris said...

Same deal as last two comments. Can anyone think of anything else to try?

Anonymous said...

Quote last three comments :(
Can you help me?

aelfwyne said...

Same problem here as the last several posters. Followed instructions to a T and yet, when restarting the emulator, there's no market. Has Google sent out an update to cripple this? Why are they so hell-bent on there being no Market on the emulator?? It's not like anyone who wanted to pirate couldn't do it on a real device...

Vijay Mudivedu said...

Hi Varun,

Did all the steps you had mentioned three to four times, but couldn't get the android market app running. There was no error when doing these steps..

Tried the Vending and Googleserviceframework.apk files and all the stuff still the app doesn't run..
Tried it with Googles API level 8 simulator, and other simulators, still stuff doesn't work.

What can be the issue?

aditya said...

hi varun,
i have a doubt in step 5 can u help me please when i type the command in cmd i get a error please help me

John Rose said...

Varun

When I try starting the emulator with the partition -size option< I get:
john@JohnLaptop:~/Android$ tools/emulator @avdMyPhone –partition-size 100
PANIC: Could not open: /home/john/.android/avd/avdMyPhone.inijohn@JohnLaptop:~/Android$
(where I am using Android SDK 2.3.3).
I used @avd rather than -avd because otherwise I get:
invalid command-line parameter: –partition-size.
Hint: use '@foo' to launch a virtual device named 'foo'.
please use -help for more information

What's the solution to the PANIC bug?

John Rose said...

The PANIC problem was due to there being different types of hyphen: I had 2 types in the 'tools/emulator @avdMyPhone -partition-size 100' command. I've done the rest of the instructions (including the above command). Market icon now appears. Clicking it gives a screen asking for Signup/login to Google account. I enter my existing gmail account details but this eventually results in "Can't establish a reliable data connection to the server". I am able to use the internet browser OK. Googling: I've opened port 5228.

Vinay said...

Varun,

I tried the exact steps 3 times and

1) I don't have market installed on my emulator. The emulator is running on Ubuntu and I have selected the exact same SDK version
2) All the changes made to build.prop gets reverted back even after removing the SDKsetup.apk.

This is happening consistently. Have you had to deal with this and if so how did you solve this problem?

hiren vasani said...

did 3 times, still android market is not coming? i m running android 2.3.3 APi 10

I'm developing on a mac and I can't find the folder where the virtual devices I've created are stored.
There is no "/.android/avd’ folder on my system and when I search for the name of the virtual devices I've created, nothing is found.
Can anyone help?

Szasz Tamas said...

joao cunha jeronimo, you need to search for that folder in your home directory. /Users//.adroid/...

This doesn't work. Marked is installed, but there is nothing to download. How to fix this?

vivek said...

hi
lets assume we install market [tough though] then if u wish to install any app from the market will not google say "this phone is not registered??" because i am using sdk

Anonymous said...

Hi, i'm running 2.3.3 API 10. I followed all the steps, no errors. But Market is not there..... does this only work for Android 2.2? or something needs to be done differently for 2.3.3?

Mina said...

It worked some months ago.... but it doesn't work anymore. :-(

Market cannot download anything.
Has someone a solution or a fix?

Anonymous said...

Just followed all steps, and no error reported, but the Martet still not avaialble. It seems that something has done in the SDK to block the Market. Really too bad.

Anonymous said...

I think Google guys fixed something.
When I reboot the emulator, every hacking is cleared.

Anonymous said...

Doesn't work anymore. :(

gamestopper said...

hi..varun ..i had done all the neccessary thing..but my connection with google is not setting properly what will be the problem..

chriv said...

I'm obviously doing something wrong. Changes I make to the system partition do not persist. I have carefully followed every step in the guide.

Ryan said...

Wow this is so cool! I managed to get market installed. But I am getting a hard time linking a google account. :)

MoA Ninja said...

when u say run from cmd how exactly do i do that. do i just goto start and bring up a cmd prompt window by typing cmd. need help with bringing up a cmd prompt specific to running avd's.

Satheesh said...

Hai Varun, Its not workin in "SDK 4.0"

http://imageshack.us/photo/my-images/72/55200507.jpg/

And also there is no userdata.img
in android-14.

phantom said...

Hi,

Its a very informative post. I tried exactly all the step you said.

I am using Android 2.3.3 emulator.

1. The build.prop is already set to "yes", so I didn't do anything on that.
2. I managed to set 777 for system/app folder and pushed the Vending.apk and GoogleServisesFramwork.apk.
3. I also removed the SdkSetup.apk
4. I closed the emulator and run again.
5. Market doesn't show up.

I went inside the system/app folder and see that Vending.apk and GoogleServicesFramework.apk is missing and SdkSetup.apk is available.

I tried several times and ended with same result.

One of the time I just tried to install GoogleServicesFramework.apk and got Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES], but I could see the market icon. When I click the market icon and click login, its not authenticating my gmail account.

Need your help on this....

David said...

I spent most of this day following and refollowing these instructions and get the same result. Market app is not there.

Should have read these comments before I tried. Tried with 2.2 and 2.3.

I did learn a lot of stuff, though.

Anonymous said...

Does this still work I cant get it to work?

237492323 said...

I am doing research on twitter and for that i need to install its official version on my Android emulator 2.2

I have installed emulator + Android Market but twitter official version is not listed in the market list and i also try to download through web site but it does not work?
Kindly let me know how can i install twitter official version provided by Android?

Alex said...

Not working, I also lost time trying several times without reading the comments..
sdksetup.apk is restored every time and the copied sdks are gone - i guess this is the problem..

237492323 said...

Is this works for window 7 too?

Rashmi said...

Hi,
Thanks. I am able to get the android market on ICS emulator, but not able to connect to google account and it is giving the following error. Please let me know if any solution.

D/GTalkService( 537): [GTalkService.85] account missing
I/GTalkService( 537): [ServiceAutoStarter] --- account changed
I/GTalkService( 537): [ServiceAutoStarter] --- start GTalk service ---
D/GTalkService( 537): [GTalkService.1] onStartCommand: found 0 connections, force audit connections...
D/GTalkService( 537): [GTalkService.86] account missing
D/ExchangeService( 404): Reconciling accounts...
E/vending ( 492): [86] VendingApplication.getAuthTokenBlocking(): no matching accounts for ANDROID
D/ExchangeService( 404): Reconciling accounts...

Anonymous said...

If you can't seem to set the size of you System partition with 'emulator –avd DemoDevice –partition-size 128',
note that it might be bigger than 128M.
The emulator for Android 4.0.3 has a system disk of already 168M so setting it to 128M still does not give you any free space and pushing the build.prop file will give an 'Out of memory' error.
Setting it to 'emulator –avd DemoDevice –partition-size 256' will solve that propblem.

Anonymous said...

failed to push GoogleServiceFramework.apk permission denied

 
Varun's Scratchpad. All contents in this blog are licensed under Non-Commercial Share Alike 2.5 license.