lkubuntu

A listing of random software, tips, tweaks, hacks, and tutorials I made for Ubuntu

How to remotely access android on your host machine

For this tutorial, I assume you have android installed on VirtualBox or some other virtualization software. One problem with virtualbox or any other virtualization software is that you cannot access the HD from your host machine (well, okay, you can use some de-compressor, but that’s usually not the best solution), but luckily, android developers made a tool called the Android Debug Bridge (ADB) which allows you to access any android device in your network (this includes a virtual android device).

First step needed is to check the IP of your android “device”, so on the android machine, press ALT+F1. This should bring you to a terminal screen (yay!). Enter “netcfg” (without quotes), and you should see an output similar to this:

lo    UP   127.0.0.1     255.0.0.0      0x123456789
eth0  UP   192.168.0.101 255.255.255.0  0x987654321

Check the IP of the second entry (which, in this case, is 192.168.0.101). On the host machine, open a terminal (if you haven’t already), and enter this command:
adb connect 192.168.0.101
Replace the IP by the IP you saw when running netcfg. This command will simply connect your host machine to the android device so that you can access it. If you need to run this command more than once, run “adb disconnect” (without quotes) before reconnecting so that you will only have one connection. You can now safely press ALT+F7 on VirtualBox to restore the android GUI :).

Now that we have connected, we can do anything we want (yes, it can be used for malicious purposes too :/). Here are a few common tasks (at least they are common for me :P):

  • Transfer a file to android:
    adb push path/to/file path/to/destination
  • Transfer a file from android:
    adb pull path/to/file path/to/destination
  • Install an application to android:
    adb install path/to/application.apk
  • Run a shell (on the host machine, very useful when virtualbox is not responding)
    adb shell
  • Shutdown
    adb shell reboot -p

All possible commands are listed if you run
adb --help

Advertisements

One response to “How to remotely access android on your host machine

  1. Pingback: Today’s Links | PICwebs

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: