Debug a Bluetooth App with Android Emulator on PC

  1. Install VirtualBox. I have version 4.2.10.
  2. Follow these instructions to create a new VM and install android-x86 on it.

Bluetooth Configuration

  1. If you use a Bluetooth USB adapter, follow these instructions to access it from the guest OS (I stopped at “Verification Under the Guest OS”). 
  2. If you use a laptop’s built in Bluetooth device, this should do the trick.
  3. Enable Bluetooth on the guest OS, make sure you can see and pair with whatever device you want.

Network and Remote Debug Configuration

  1. Follow these instructions to enable internet connection on your VM.
  2. Find the IP of your VM by goint to the terminal (Alt+F1 and Alt+F7 to toggle) and running netcfg.
  3. On the host machine, navigate to your android installation folder > platform-tools and execute “adb connect IP” where IP is the IP of your VM.

Now you can see your device in the devices view in eclipse and play with it to your heart’s content.

Other nuisances

  1. If the cursor is not responding when you start your machine, go to Machine ->Disable Mouse Integration. You will have to click on the VM screen to interact with it and press “host” key to escape.
  2. Seems like the current version of Android-x86 has a bug that prevents it from “waking up” when it is locked. You probably want to disable screen locking so that you don’t have to restart the machine after every time you go to the loo.
  3. You can configure the “adb connect” command as an external tool in eclipse so that you can run it inside your IDE:
    1. Click the little arrow near the external tools button, and choose “External Tools Configurations…”
    2. Click “new”
    3. Name your configuration (i.e: “Remote connect adb”)
    4. Location: path to your adb.exe
    5. Working Directory: platform-tools folder in android installation folder
    6. Arguments: connect IP
      Alternatively, you can use ${string_prompt} instead of IP if you want eclipse to ask you which IP you cant to connect to each time you run the command.
    7. Click “Apply”

And that’s it.