Thursday, May 24, 2012

Use adb To Install Google Apps (Includes Google Play) To Android 4.0.3 Buildroid In VirtualBox


Android - VirtualBox
Android Ice Cream Sandwich is well supported to run in VirtualBox with Buildroid VM image. There are three types of Buildroid VirtualBox images for phone, tablet, and tablet with phone capabilities. These images do not come with Android Market/Google Play and other Google apps. To spice up your Android VM with more Android apps, we can first install Market/Play app to the Android VM with the help of Android Debug Bridge (adb).

There is a Buildroid "for testing purpose only" VM image available for download which includes Market/Play app and other Google apps. Reading the description it is for testing purpose only, I'm not sure how stable it is. If you use the normal Buildroid VM image, here's how to install Market/Play app to Android Virtual Machine.

Steps:
  1. Assume you have already setup your Android Virtual Machine. Guide to setup Android in VirtualBox.
  2. You can get the adb (Android Debug Bridge) utility here.
  3. Download Google apps here.
  4. Open VirtualBox.
  5. Go to Buildroid VM's Settings > Network.
  6. Under Adapter 1 tab, choose Attached to: NAT.
  7. VirtualBox - Network
  8. Expand Advanced and click Port Forwarding button.
  9. Click Insert new rule button, input 5555 into Host Port and Guest Port. Click OKs to return to VirtualBox. If you have multiple virtual machines and want to connect to each of them, you could increment the host port for each of the forwarding rules while keeping the same guest port for each device (eg. host port 5556, guest port 5555 on a second virtual machine).
  10. VirtualBox - Network Port Forwarding
  11. Now Start Auildroid VM.
  12. Open Buildroid VM Configuration, you should see the IP address under IP management to confirm it is working. If there is no IP address showing, adb will not be able to connect your Auildroid VM.
  13. Find the folder where the adb.exe is located. For example: c:\android-sdk-windows/platform-tools
  14. Press and hold Shift key + right click on the folder which contains adb.exe. Click Open command window here.
  15. Enter: adb connect localhost
  16. Copy the .tgz Google apps file to Android with this command:
  17. adb push buildroid-gapps-ics-20120317-signed.tgz /sdcard/
    Note: you must specify the directory location of your tgz file. For example, d:\downloads/buildroid-gapps-ics-20120317-signed.tgz as shown in the screenshot below:
    Android Debug Bridge (adb ) - adb push
  18. Execute the following commands:
    • adb shell
    • su
    • mount -o remount,rw /system
    • tar -xvzf /sdcard/buildroid-gapps-ics-20120317-signed.tgz
    • mount -o remount,ro /system
    • reboot
  19. Your Android VM will reboot automatically and new Google apps including Play Store app are installed.
  20. VirtualBox - Android-x86

37 comments:

  1. Can I use the AVD Manager?

    ReplyDelete
  2. I don't think so. The image is in ova file extension which is supported by the programs like VirtualBox and VMware.

    ReplyDelete
  3. hey...these files dont work on my computer.....i used both VMWARE n VirtualBox...it stucks on booting kernal...i tried all three versions......
    My computer specs
    Phenom X4
    8GB ram

    ReplyDelete
  4. Hi, I suspect it doesn't support AMD processor. I could be wrong. Do you have a Intel computer to test it?

    ReplyDelete
  5. adb connected to local host but entering the command
    adb push buildroid-gapps-ics-20120317-signed.tgz /sdcard/ say error more than one device and emulator

    ReplyDelete
  6. i got the same thing. am going to use something like airdroid to extract apks and upload to dropbox, then insall on vm. you can also use the unstable one, which is ok but does sometimes fail. good luck!

    ReplyDelete
  7. Use @Jack Cohen 's suggestion, it is much easier installing apps on vm. Or, if you insist using adb, try the command below to connect vm and let me know how it works for you:


    adb –s localhost:5555 shell

    ReplyDelete
  8. Thanks, it is very helpful. Quite a lot of people getting "error: more then one device and emulator" message.

    ReplyDelete
  9. I got this same error but i had success by killing the adb server using the command "adb kill-server" minus the quotes and repeating the steps without using the connect to host command. i believe it connects automatically when you invoke adb so by using the connect to host first you are creating 2 instances. Thus the more than one device error.
    in the command prompt you can check the connected devices by typing
    "adb devices" minus the quotes and hitting enter. Then continue with the above procedure. I'm no expert but this worked for me. i hope it helps.

    ReplyDelete
  10. Thanks cadam. Somehow adb is already connected to Android VM by itself. I don't know what's causing this. So we have to always check the connected devices first with adb devices.

    ReplyDelete
  11. I'm stuck on step 15. when i type "tar -xvzf /sdcard/buildroid-gapps-ics-20120317-signed.tgz" i get an error saying there's no such file or directory

    ReplyDelete
  12. It couldn't find the .tgz archive to extract inside your Android sdcard directory. Try again send the .tgz archive with the command below.


    adb push (You file directory)/buildroid-gapps-ics-20120317-signed.tgz /sdcard/

    ReplyDelete
  13. i dnt have intel.......

    ReplyDelete
  14. the right extension for "buildroid-gapps-ics-20120317-signed.tgz" is "gz" and not "tgz"==> to correct so when typing commend

    ReplyDelete
  15. I tried several times to push the directory. It succeeded fine but still getting the error - tar not found? HELP!!

    ReplyDelete
  16. I repeated all steps and installed the Google apps successfully. Are you sure the .tgz file is in the /sdcard directory?


    If you still can't extract it, you can use this Android 4.0.4 image file already bundled with Google apps. This is a easier way.

    ReplyDelete
  17. step 15. when I want to type ´adb shell´ then i get a message ´error: more than one device and emulator´

    ReplyDelete
  18. Hi rami,


    I was facing the same problem as you are having. This is my solution.

    -Type "adb devices", and if you see list of devices attached like this below:
    emulator-5554 device
    localhost:5555 device


    -Enter "adb kill-server" and connect your Android VM again.



    Always perform the "adb devices" to check how many instances are currently connected with adb tool because sometimes adb will connect with more than one emulator/device instances after entering "adb connect localhost" for some reason.



    Regards,
    Mok

    ReplyDelete
  19. Since the adb is an .exe file, how would this work on a Mac?

    ReplyDelete
  20. Hi rami,


    I was facing the same problem as you are having. This is my solution.

    -Type "adb devices", and if you see list of devices attached like this below:
    emulator-5554 device
    localhost:5555 device


    -Enter "adb kill-server" and connect your Android VM again.



    Always perform the "adb devices" to check how many instances are currently connected with adb tool because sometimes adb will connect with more than one emulator/device instances after entering "adb connect localhost" for some reason.



    Regards,
    Mok

    ReplyDelete
  21. step 15. when I want to type ´adb shell´ then i get a message ´error: more than one device and emulator´

    ReplyDelete
  22. Hi Mo, I've uploaded adb for Mac version. You can download it here.

    ReplyDelete
  23. Thanks for the link there, but i have the same problem as the guy above, tar does not seem to exist on the version i am running, fetched from here: http://vmlite.com/index.php?option=com_content&view=article&id=68:android&catid=17

    Are there any other extraction programs?
    All standard linux commands seem to work fine, but tar is not there.

    ReplyDelete
  24. i get an error that adb is not recognized as an internal or external server what should i do ..???????

    ReplyDelete
  25. I get a permission denied

    root@android:/ # su

    root@android:/ # mount -o remount,rw /system

    mount: Permission denied

    255|root@android:/ #

    ReplyDelete
  26. I have installed Android X86 on a USB flash drive, it is working fine except Bluetooth is not working and i can not able to install any application from Google Play , it says that your device is not compatible. any idea how can use bluetooth and install APPs.

    ReplyDelete
  27. When I tried installing WeChat, it said "Your device isn't compatible with this version."

    ReplyDelete
  28. this error happened a lot, and when is saying push adb (file) it says android debug bridge version 1.0.29. what to do?

    ReplyDelete
  29. Hello, I made it to step 15 when I tried to enter "adb shell" and got a message of "error: device is offline" I noticed in step 10 you mentioned IP configuration, however, I am not sure where I would look for the IP config and address or where I should place it. Please help, Thanks!

    ReplyDelete
  30. Easy workaround : Don't use adb shell, install Terminal Emulator app ( Download apk from Github Here :
    http://jackpal.github.com/Android-Terminal-Emulator/downloads/Term.apk
    )
    Launch the app inside the VM, then type the same commands as you would have in the adb shell (e.g. starting with su and then the mount command and then the rest)

    ReplyDelete
  31. Visit this post nice information in this post.this blog help
    you in future, I like this post the post is very post. I like it.once again
    thanks.!! recording app

    ReplyDelete