Android蓝牙:软件导致连接中止IOException?

vic*_*vic 8 android bluetooth rfcomm

可能重复:
"软件导致连接中止:套接字写入错误"的官方原因

我有蓝牙问题我无法连接Droid.我总是得到这个IOException

08-09 20:58:24.889: INFO/BluetoothChat(17378): MESSAGE_STATE_CHANGE: 3
08-09 20:58:51.053: DEBUG/BluetoothService(17378): BT_SEND_MESSAGE
08-09 20:58:51.108: ERROR/BluetoothService(17378): disconnected
08-09 20:58:51.108: ERROR/BluetoothService(17378): java.io.IOException: Software caused connection    abort
08-09 20:58:51.108: ERROR/BluetoothService(17378):     at android.bluetooth.BluetoothSocket.readNative (Native Method)
08-09 20:58:51.108: ERROR/BluetoothService(17378):     at android.bluetooth.BluetoothSocket.read(BluetoothSocket.java:286)
08-09 20:58:51.108: ERROR/BluetoothService(17378):     at android.bluetooth.BluetoothInputStream.read(BluetoothInputStream.java:96)
08-09 20:58:51.108: ERROR/BluetoothService(17378):     at java.io.InputStream.read(InputStream.java:133)
08-09 20:58:51.108: ERROR/BluetoothService(17378):     at my.test.BluetoothChatService$ConnectedThread.run(BluetoothChatService.java:356)
Run Code Online (Sandbox Code Playgroud)

我怎么解决这个问题?

小智 -2

<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
    <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"></uses-permission>
Run Code Online (Sandbox Code Playgroud)

添加这些权限。

  • 您可以编辑之前的答案,而不是删除它并添加另一个答案。如果您添加更多文本来解释问题是什么以及为什么可以修复它,这个答案会更好。 (3认同)