蓝牙与安卓
我是 android 新手,我将使用蓝牙,但是当我像我在这里表达的那样导入蓝牙时:
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothServerSocket;
import android.bluetooth.BluetoothSocket;
我的 SDK 无法实现 android.bluetooth 。此外,我添加了“Android SDK 和 AVD Manager”中的所有包和设备,但仍然有问题。你能帮我知道如何解决这个问题吗? 谢谢。
I'm new in android and I'm going to work with Bluetooth, but when I import bluetooth like the lines I express here:
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothServerSocket;
import android.bluetooth.BluetoothSocket;
my SDK can not realize android.bluetooth . In addition, I add all packages and devices from "Android SDK and AVD Manager" but I still have problem. Could you help me to know how can I solve this problem.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
摘自开发者网站:
它们对我来说导入得很好,也许您应该运行软件更新程序并确保您已下载所有软件包?
最后一件事,SDK不能使用蓝牙包,你必须在真实设备上进行测试。
Taken from the developer website:
They import fine for me, perhaps you should run the software updater and ensure you've downloaded all the packages?
One last thing, the SDK cannot use the bluetooth package and you must test on a real device.
你们使用什么样的开发环境?这些包和类位于 android.jar 中
如果您有 Eclipse 插件和 SDK 并创建了一个 android 项目,则您必须在项目中包含 android.jar 并且您不应该有这个问题。
如果您的环境不同,请确保 android.jar 在您的 CLASSPATH 中。它将位于安装 SDK 的 platforms\android-2.1 下。 (假设您使用的是android 2.1)
What kind of development environment do you use ? These packages and classes are in android.jar
If you have Eclipse plugin and SDK and create a android project , you will have to project include the android.jar and you should not have this problem.
If your environment is different, make sure that android.jar is in your CLASSPATH. It will be under platforms\android-2.1 where your SDK is installed. (assuming you are using android 2.1)
打开项目属性,Android,选择您的目标
Open project properties, Android, Select your target
我遇到了同样的问题,要解决问题,请升级 android 最低所需的 android 版本:
project/properties/android ->目标名称,
并至少选择 API 版本 7 (android 2.1)
当然,在清单中添加蓝牙声明
I had the same issue, to solve the problem, upgrade the android min required android version :
project/properties/android -> target name,
and select at least API version 7 (android 2.1)
and of course add the bluetooth declarations in the manifest