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.

Advertisements

2 thoughts on “Debug a Bluetooth App with Android Emulator on PC”

  1. About the link to the instructions for creating the VM Android X86:
    I’m having difficulties with the creation of the virtual sd card. The problem is that when press not appear “DATA=”,and “SDCARD=” which appears in place is “SRC=” and “DATA=”. Have you any idea why this happens? And how to solve this?
    I think here is not the most appropriate place to post this doubt, but I’m a little desperate.
    Thanks in advance.

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