Monday, September 06, 2010

How to use Android Market on Android Emulator 2.2

After some digging, finally I got android market working on Android emulator 2.2 running on Windows Vista. Here is the steps,:
  • Start SDK Setup.exe and create an AVD - android-2.2
  • Copy system.img coming with the SDK platform to the newly created AVD.
cd c:\Users\dliu\.android\avd\android-2.2.avd
copy c:\labs\android-sdk-windows\platforms\android-8\images\system.img .
  • Start the emulator by using command line:
c:\labs\android-sdk-windows\tools>emulator -avd android-2.2 -partition-size 96
  • Pull build.prop from the emulator for editing:
c:\labs\android-sdk-windows\tools>adb.exe pull /system/build.prop .
  • Comment out ro.config.nocheckin=yes line from the build.prop file just pulled out from the emulator.
  • Push back the updated build.prop file to the emuloator
C:\labs\android-sdk-windows\tools>adb.exe remount
C:\labs\android-sdk-windows\tools>adb.exe push build.prop /system/build.prop
C:\labs\android-sdk-windows\tools>adb.exe push c:\labs\r21-update-nexusone-modacocustomcustomrom-withadditions-chinese-signed\system\app\GoogleServicesFramework.apk /system/app
C:\labs\android-sdk-windows\tools>adb.exe push c:\labs\r21-update-nexusone-modacocustomcustomrom-withadditions-chinese-signed\system\app\Vending.apk /
system/app
C:\labs\android-sdk-windows\tools>adb shell rm /system/app/SdkSetup.apk
  • Stop the emulator and delete the files: userdata-qemu.img, userdata.img, cache.img
  • start the emulator by using command line again, you should get the Android Market in your emulator.

44 comments:

Brian said...

Thank you for the tutorial, I greatly appreciate it. I noticed that I am unable to find all of the apps in the Market that are available on my physical Android device. Have you seen similar behavior?

David L said...

@Brian, Yes, I also noticed that I could not find all of the apps in the Market.

Zzzz said...

THANKS! I needed to test a feature of my app using 2.2 and the market. Your tutorial totally worked.

varunthacker said...

Can you please translate these commands for linux users.

for pull build.prop i tried
./adb pull /home/varun/android-dk-linux_86/platforms/android-8/build.prop .

and i got an error:
remote object '/home/varun/android-sdk-linux_86/platforms/android-8/build.prop' does not exist

What am i doing wrong?

Unknown said...

Linux Users

1. Create your avd using either terminal or gui.

A. Terminal - cd to the location of your SDK tools folder and run
./android create avd -n android-2.2 -t 7

B. Gui - run ./android from you SDK tools folder and make a new 2.2 virtual device
named android-2.2

*Note - Replace the 7 in the terminal with whatever 2.2 is for you. You can find out by running
./android list target


2. Copy the system.img from your sdk using the terminal or manually

Terminal - cp /home/USER/location of sdk/platforms/android-8/images/system.img ~/.android/avd/android-2.2.avd


3. Start the emulator using either the terminal or gui

A. For terminal (Make sure your in your SDK tools folder) - ./emulator -avd android-2.2 -partition-size 96


4. After the emulator has fully started we need to pull build.prop (Open a terminal if needed and go to the tools folder)

A. Terminal - ./adb pull /system/build.prop

*Note - Open a new terminal or a new tab and cd back to the tools folder of the sdk.


5. Comment out ro.config.nochecking=yes from the file by putting a # in front of the line.

A. Terminal - gedit build.prop

B. Save changes and exit


6. Push back the update build.prop

Terminal - ./adb remount

./adb push build.prop /system/build.prop

7. Get the custom rom linked above. Extract it to your desktop and rename the folder
to r21


8. Run the following commands in the terminal

./adb push ~/Desktop/r21/system/app/GoogleServicesFramework.apk /system/app

./adb push ~/Desktop/r21/system/app/Vending.apk /system/app


9. Remove the SdkSetup file

./adb shell rm /system/app/SdkSetup.apk


10. Finally stop the emulator and run these commands in terminal

cd ~/.android/avd/android-2.2.avd

rm -R userdata-qemu.img userdata.img cache.img


11. Start up the emulator and you should now have the market!

Anonymous said...

Everytime I get to the step of pushing the modified build.prop file back to the emulator, I get the error, "Failed to copy 'build.prop' to '/system/build.prop': Out of memory". I have tried this on an XP VM, an XP real box, and an Ubuntu 10.4 machine following the provided Linux users instructions and get the same error on every machine. Can anyone help? Thanks!

Unknown said...

Thanks David!
I've been struggling with this for two days, and you're the only one I've found who did it.
You rock!
D.

HyperShadow said...

excellent method! works great. Been trying for quite a while without success. The only thing is that the Vending.apk from Modaco seems to be missing many many apps. Can we simply remove the vending.apk and push another one instead? If so, which would you suggest?

Unknown said...

I am not an Android application developer but just want to try out Android application before installing them to my device. I successfully installed the SDK Manager in my Windows XP and created an AVD. I am also able to start the AVD in the SDK manager. However, I am not able to follow the steps you mentioned here. I even cannot find the "system.img" in any directory, let alone copying it to AVD folder. I also has no idea what command line is....

I will very much appreciate if a step by step instruction can be provided here for Windows XP users.

Morten Hjerl-Hansen said...
This comment has been removed by the author.
ek_skotous said...

Thanks for the tutorial. I have been searching for MONTHS on a guide just like yours! I want to use an AVD for a little Android training session I will be doing to help train some peers on the platform. Having the Market is a MUST. I have this working somewhat now based on your info but I have a couple of problems 1) I had to use a different source I found for the Android 2.2 .APKs since the Modaco link was broken. Is there another suggested source you have which is known to work 2) When I follow these steps it seems that the home button for this AVD is broken within the emulator program. Anyone else seen this and is there a fix? 3) I cannot find many apps in the market. I am not sure how the version of Vending.apk effects this since the list is being updated constantly and its suppsed to pull live data from the network. Is there a fix for this?
4) Can I use custom command line options such as a partition-size larger than 96MB if I want more space on the AVD? Can I launch the AVD through the AVD Manager tool or do I always have to use the command line you listed from now on with this VM?

Any suggestions or comments on any of these questions would be greatly appreciated?

siva said...

I have done everything , i cant find Market in emulator...

Unknown said...

Followed all the steps too, verified that build.prop has line commented out and Vending and GoogleServicesFramework is present in appropriate locations. Added my google account to the device. Still no Android Market. Any ideas what to do?

Unknown said...

I am able to get Android Market in My Froyo(Android 2.2) Emulator. But I am not able to find and install any flash player using this Android market App for my Emulator.
Any pointer would be really appreciated!!

Thanks,
Pranjal

Marco said...

Doesn't work at all the Market Icon doesn't come up

Unknown said...

Hi David,

Thanks for the post. It works for me. I have put up a short post regarding this.

http://techdroid.kbeanie.com/2011/01/android-market-on-emulator-22.html

Marco said...

solved but it's useless beacouse practically no app is available like facebook and so on

roshan said...

Thank you very much. It worked out for me. Could u plz help me how to work with Cloud to Device Messaging using push api

Anonymous said...

I'm newbie for programming and never school about it, just see from other blog. I has been use Android Emulator 1.6 but I wanna to use new version. So today, I'm try your post.

I type D:>Program Files/Android/android-sdk-windows/tools>emulator -avd MyMarket22 -partition-size 96

on cmd and it's work. I was waited until Startup finish. But I can't type anything...

I was tried open new cmd (without closed SDK), and type
D:>Program Files/Android/android-sdk-windows/tools>adb.exe pull /system/build.prop

but it's not work!!

I'm using Windows XP in 32byte.
Sorry if my english too bad... :P

Anonymous said...

finally... I get it... hohohohoho... I was wrong type.

Abdul Waheed said...

hey i followed your step(Linux user Commented by Gage)..Till 3rd it was workin fine..but i am getting error ./adb not found i,e

. After the emulator has fully started we need to pull build.prop (Open a terminal if needed and go to the tools folder)

A. Terminal - ./adb pull /system/build.prop

*Note - Open a new terminal or a new tab and cd back to the tools folder of the sdk.
please help..Thanx in advance

Abdul Waheed said...

i got adb that was in platform-tools folder not in tools...but agian after running that line getting error:
device not found..what should i do now?i have already opened emulator

Unknown said...

$android-sdk/platform-tools/adbadb push file /system/..

and meet problems like “failed to copy file to /system/…”, such as:

failed to copy ‘file’ to ‘/system/…’: No space left on device
failed to copy ‘file’ to ‘/system/…’: Out of memory

Don't use AVD Manager to start the Android emulator, use the command line:

$android-sdk/tools/emulator–avd youravdname –partition-size 128

then
$android-sdk/platform-tools/adb remount

Then you can try the command “adb push file /system/…”, and the problem maybe resolved.

Unknown said...
This comment has been removed by the author.
Unknown said...

David,

Thank you very much for the tutorial for copying 2.2 sys img. When I go to copy it, I get a message saying file cannot be found. I moved the sys.img file to one the folders in my sdk platform folders even so I could easily find it. Any ideas to what I may be doing wrong here. Thank you for your time in posting your comments

Unknown said...

Thank you, but I don't understant, my appmarket is not full. It miss lot of applications :(

_ said...

For Linux-Users not finding the "adb" command.

The Readme states:

The adb tool has moved to platform-tools/

So the adb command is no longer in the tools directory, but in a directory called platform-tools.

Just cd there and everything should work fine.

akshatkhajuria said...

my emulator is not starting. It just flashes a cmd type of window for a second,and then nothig appears after that......

pinkpea said...

Has anyone gotten more apps to show up on market? If so please explain how it was done. I saw on another thread that you can get all the apps to show up via turning on hardware options such as GPS, and touchscreen ...etc. However, I had not luck getting more apps to show up. Also, the link to modaco no longer has the r22 download link.

Looter said...

Same here.
I somehow managed to set it up once so the market worked.
But can't reproduce now. Killed a day already. Please help!
The market is available. When accepted terms/conditions, it crashes. All consequent attempts result in "No matching content in Android Market". HELP!

wildc said...

Mike: for fix out of memory you should reserve memory for system, run with:
emulator -partition-size 512

and then make it writeable with:
adb shell
mount -o rw,remount -t yaffs2 /system

Android app development said...

This is one of the excellent post.This is one of the good quality information.I like your blog technique.
Android app developers

Vindy said...

I did all steps and everythng worked but at final step could not delete cache.img qxx.img - I have double cheked emulator was stoped and .lock files were deleted still file in use kind of thing dint allowed me to continue further...!

John said...
This comment has been removed by the author.
John said...
This comment has been removed by the author.
Unknown said...

Hi, very good and informative post about
Android Training In Chandigarh
. Hre i want to tell u that in mohali we also provide the industrial training at reasonable price.Thanks

Anonymous said...

Hi
I really hope your the best software development company in Chandigarh and providing the quality services to people.Php Training In Chandigarh

Unknown said...

Which association is giving the best Android Application Development organizations in Karachi?

Ahsan12 said...

Great. Thanks for sharing . Keep it up. web design and development services

chhassnain said...

We are the best SEO services company, we find and fix the errors on your website .As a SEO services company, we tend to facilitate brands reach new customers
through search optimization and social media organic visibility.

Maha Queen said...

Android is a mobile operating system based on a modified version of the Linux kernel and other open source software, designed primarily for touchscreen mobile devices such as smartphones and tablets.
Custom Web Development

Royal Cracks said...
This comment has been removed by the author.
WebCodifier.com said...

Thanks, It helped me a lot. Appreciated!
Web Design Company in Pakistan

Mahnoor khan said...

Great article keep sharing ideahits

Full Guide for using Bitnami Prometheus Operator Helm Chart with Additional Scrape Configuration

"The Prometheus Operator for Kubernetes provides easy monitoring definitions for Kubernetes services and deployment and management of...