如何使用内置笔记本电脑蓝牙在 VirtualBox 上测试基于 Androidx86 的蓝牙应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12135442/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to test Bluetooth Based Application on Androidx86 on top of VirtualBox with inbuilt laptop bluetooth
提问by praba
How can I run Bluetooth Based application on Android emulator on my laptop. When I run the Bluetooth application, it's said, Bluetooth Device not connected. I was googled and I found a way for using Oracle VM VirtualBox
. and I followed this steps too,
如何在笔记本电脑上的 Android 模拟器上运行基于蓝牙的应用程序。当我运行蓝牙应用程序时,提示未连接蓝牙设备。我用谷歌搜索,我找到了一种使用Oracle VM VirtualBox
. 我也跟着这个步骤,
- Download Androidx86 from http://www.android-x86.org/. This is an .iso file, so you'd need something like VMWare or VirtualBox to run it. Me, I use VirtualBox.
- When creating the virtual machine, you need to set the type of guest OS as Linux instead of Other.
- After creating the virtual machine, set the network adapter to 'Bridged'.
- Start the VM and select 'Live CD VESA' at boot.
- Now you need to find out the ip of this VM. Go to terminal in VM (use Alt+F1 & Alt+F7 to toggle) and use the netcfg command to find this.
- Now you need open a command prompt and go to your android install folder (on host). This is usually C:\Program Files\Android\android-sdk\platform-tools>.
- Type adb connect IP_ADDRESS
- There done! Now you need to add Bluetooth. Plug in your USB Bluetooth dongle.
- In VirtualBox screen, go to Devices>USB devices. Select your dongle.
- Done! now your Android VM has Bluetooth. Try powering on Bluetooth and discovering/paring with other devices.
- Now all that remains is to go to Eclipse, and run your program. The Android AVD manager should show the VM as a device on the list.
- 从http://www.android-x86.org/下载 Androidx86 。这是一个 .iso 文件,所以你需要像 VMWare 或 VirtualBox 这样的东西来运行它。我,我使用 VirtualBox。
- 创建虚拟机时,需要将guest OS的类型设置为Linux而不是Other。
- 创建虚拟机后,将网络适配器设置为“桥接”。
- 启动 VM 并在启动时选择“Live CD VESA”。
- 现在你需要找出这个虚拟机的 ip。转到 VM 中的终端(使用 Alt+F1 和 Alt+F7 切换)并使用 netcfg 命令找到它。
- 现在您需要打开命令提示符并转到您的 android 安装文件夹(在主机上)。这通常是 C:\Program Files\Android\android-sdk\platform-tools>。
- 输入 adb 连接 IP_ADDRESS
- 完成了!现在您需要添加蓝牙。插入您的 USB 蓝牙加密狗。
- 在 VirtualBox 屏幕中,转到设备>USB 设备。选择您的加密狗。
- 完毕!现在你的安卓虚拟机有蓝牙了。尝试打开蓝牙并发现/与其他设备配对。
- 现在剩下的就是转到 Eclipse 并运行您的程序。Android AVD 管理器应将 VM 显示为列表中的设备。
I did this and it's working fine. but the problem is, if I use Bluetooth Dongle it's working good, but I can't use my Laptop's inbuilt Bluetooth device with VM Machine. How can I connect my inbuilt Bluetooth device with VM Machine and how can I use it for Test Bluetooth Based Application.? Kindly suggest some ideas. thanks in Advance..
我这样做了,它工作正常。但问题是,如果我使用蓝牙加密狗,它运行良好,但我无法将笔记本电脑的内置蓝牙设备与 VM Machine 一起使用。如何将内置蓝牙设备与 VM Machine 连接,以及如何将其用于测试基于蓝牙的应用程序。?请提出一些想法。提前致谢..
采纳答案by Rathakrishnan
In the Virtual Box :
在虚拟盒子中:
right click and go to settings
select Serial Ports and Enable it
click Ok.
Now click Start
Select Devices from Top Menu
Select USB Devices
Select your Bluetooth Adapter that's all. now You can use your Laptop Bluetooth for VM.
右键单击并转到设置
选择串行端口并启用它
单击确定。
现在点击开始
从顶部菜单中选择设备
选择 USB 设备
选择您的蓝牙适配器即可。现在您可以将您的笔记本电脑蓝牙用于 VM。
回答by InteXX
In addition to the steps in RamRaj's answer, the VM's Bluetooth adapter requires an exclusive connection. No other devices may be paired on the laptop—otherwise the connection attempt will hang.
除了 RamRaj 回答中的步骤外,VM 的蓝牙适配器还需要独占连接。笔记本电脑上不能配对其他设备 - 否则连接尝试将挂起。
If the connection is successful, you won't be able to manage Bluetooth within the laptop (host) OS for the duration of the connection.
如果连接成功,您将无法在连接期间在笔记本电脑(主机)操作系统中管理蓝牙。