我正在创建一个连接 4 个设备的应用程序。其中一个充当服务器,另外三个充当客户端。服务器还充当客户端。这是一个纸牌游戏。我给了它 7 个 UUID。当我创建服务器时,3 个客户端中的 2 个能够连接,但是当第三个客户端加入时,应用程序崩溃。这是第三个设备尝试连接时 logcat 的一部分。
05-12 15:41:55.453: E/ConnectionService(10793): getConnectedSocket : 503c7432-bc23-11de-8a39-0800200c9a66
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): IOException in getConnectedSocket
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): java.io.IOException: Service discovery failed
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at android.bluetooth.BluetoothSocket$SdpHelper.doSdp(BluetoothSocket.java:377)
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:201)
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at net.clc.bt.ConnectionService.getConnectedSocket(ConnectionService.java:191)
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at net.clc.bt.ConnectionService.access$5(ConnectionService.java:185)
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at net.clc.bt.ConnectionService$1.connect(ConnectionService.java:225)
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at net.clc.bt.Connection.connect(Connection.java:191)
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at net.dillen.satat.Satat.onActivityResult(Satat.java:308)
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at android.app.Activity.dispatchActivityResult(Activity.java:3835)
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at android.app.ActivityThread.deliverResults(ActivityThread.java:3332)
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3378)
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at android.app.ActivityThread.access$2700(ActivityThread.java:123)
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1900)
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at android.os.Handler.dispatchMessage(Handler.java:99)
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at android.os.Looper.loop(Looper.java:123)
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at android.app.ActivityThread.main(ActivityThread.java:4370)
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at java.lang.reflect.Method.invokeNative(Native Method)
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at java.lang.reflect.Method.invoke(Method.java:521)
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-12 15:41:55.463: I/net.clc.bt.ConnectionService(10793): at dalvik.system.NativeStart.main(Native Method)
minSdkVersion="7"
device OS = 2.3.3 , 2.3.3, 2.1.1, 2.1.1
操作系统版本似乎没有出现问题。