Sunday, November 1, 2015

The Android Debug Bridge (ADB) is a useful tool for developers to communicate with emulator instance and connected Android-powered device. It also works with Android-x86 virtual machine saving a lot of time when transferring files and installing apps on Android VM from computer.

Open VirtualBox, go to Settings > Network. Under Adapter 1, click Advanced and then Port Forwarding. Create a new rule with Host Port: 5555 and Guest Port: 5555. Click OK to save.

Start Android VM, then open ADB. Enter the follow command:

adb connect localhost

Now ADB has connected the Android VM. You may install/uninstall with the following commands.

1) Install .apk app on Android:
On ADB enter command line:

adb install <app name.apk>

For example, I want to install F-Droid app which is located in my computer's folder path, D:\Downloads The command line will be adb install D:\Downloads\FDroid.apk

2) Uninstall .apk app on Android:

adb uninstall <package name>

You can check all installed package name on Android VM in Dev Tools > Package Browser.
For example, I want to uninstall F-Droid. The F-Droid's package name is org.fdroid.fdroid So the command line will be adb uninstall org.fdroid.fdroid