android蓝牙错误码8,如何解决BluetoothGatt:Android中发生android.os.DeadObjectException错误?...

在尝试连接和发现BLE设备时,遇到了BluetoothGatt的DeadObjectException错误。日志显示在连接和发现服务之前,设备经历了状态变化和一系列蓝牙交互。尝试断开并重新连接BLE设备可以暂时解决问题,但错误会重复出现。服务代码示例展示了蓝牙连接、断开和发现服务的过程。寻求帮助来解决这个持续出现的错误。
摘要由CSDN通过智能技术生成

我按照页面Bluetooth Low Energy开发Android 4.3的蓝牙低功耗。

我已经可以打开蓝牙,扫描设备并连接到BLE设备。

但是,在尝试连接到device(device.connectGatt)并且发现BLE设备的服务(mBluetoothGatt.discoverServices)之前,它会显示BluetoothGatt : android.os.DeadObjectException。

在BluetoothGatt : android.os.DeadObjectException之前,它显示如下的日志

W/bt-smp (10670): io_cap = 4

W/bt-smp (10670): new io_cap = 4 p_cb->loc_enc_size = 16

W/BluetoothEventManager( 7380): CachedBluetoothDevice for device 20:73:20:00:6C:B4 not found, calling readPairedDevices().

D/BluetoothAdapterService(1108123608)(10670): Get Bonded Devices being called

E/BluetoothEventManager( 7380): Got bonding state changed for 20:73:20:00:6C:B4, but we have no record of that device.在发现服务之前连接到BLE设备时的完整日志如下所示

I/BluetoothLeService(10888): BluetoothGattCallback-----newState = 2

I/BluetoothLeService(10888): STATE_CONNECTED:

I/Device_information(10888): BroadcastReceiver---action = ti.android.ble.common.ACTION_GATT_CONNECTED

W/qdhwcomposer( 326): Excessive delay reading vsync: took 816 ms

I/BluetoothBondStateMachine(10670): Bond address is:20:73:20:00:6C:B4

I/BluetoothBondStateMachine(10670): Entering PendingCommandState State

I/BluetoothBondStateMachine(10670): bondStateChangeCallback: Status: 0 Address: 20:73:20:00:6C:B4 newState: 1

D/BluetoothAdapterService(1108123608)(10670): Get Bonded Devices being called

I/BluetoothBondStateMachine(10670): Bond State Change Intent:20:73:20:00:6C:B4 OldState: 10 NewState: 11

W/bt-smp (10670): io_cap = 4

W/bt-smp (10670): new io_cap = 4 p_cb->loc_enc_size = 16

W/BluetoothEventManager( 7380): CachedBluetoothDevice for device 20:73:20:00:6C:B4 not found, calling readPairedDevices().

D/BluetoothAdapterService(1108123608)(10670): Get Bonded Devices being called

E/BluetoothEventManager( 7380): Got bonding state changed for 20:73:20:00:6C:B4, but we have no record of that device.

E/BluetoothGatt( 8804):

E/BluetoothGatt( 8804): android.os.DeadObjectException

E/BluetoothGatt( 8804): at android.os.BinderProxy.transact(Native Method)

E/BluetoothGatt( 8804): at android.bluetooth.IBluetoothGatt$Stub$Proxy.clientConnect(IBluetoothGatt.java:739)

E/BluetoothGatt( 8804): at android.bluetooth.BluetoothGatt.connect(BluetoothGatt.java:715)

E/BluetoothGatt( 8804): at com.sonyericsson.extras.liveware.aas.AasGatt.connect(AasGatt.java:144)

E/BluetoothGatt( 8804): at com.sonyericsson.extras.liveware.aas.AasGatt.onStartCommand(AasGatt.java:105)

E/BluetoothGatt( 8804): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2768)

E/BluetoothGatt( 8804): at android.app.ActivityThread.access$1900(ActivityThread.java:150)

E/BluetoothGatt( 8804): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1395)

E/BluetoothGatt( 8804): at android.os.Handler.dispatchMessage(Handler.java:99)

E/BluetoothGatt( 8804): at android.os.Looper.loop(Looper.java:213)

E/BluetoothGatt( 8804): at android.app.ActivityThread.main(ActivityThread.java:5225)

E/BluetoothGatt( 8804): at java.lang.reflect.Method.invokeNative(Native Method)

E/BluetoothGatt( 8804): at java.lang.reflect.Method.invoke(Method.java:525)

E/BluetoothGatt( 8804): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)

E/BluetoothGatt( 8804): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)

E/BluetoothGatt( 8804): at dalvik.system.NativeStart.main(Native Method)

D/BluetoothGatt( 8804): connect() - device: 20:73:20:00:6C:B4, auto: false

D/BluetoothGatt( 8804): registerApp()

D/BluetoothGatt( 8804): registerApp() - UUID=3a123b89-8939-4d5b-ae6b-3ca1d98b4208

D/BtGatt.GattService(10670): registerClient() - UUID=3a123b89-8939-4d5b-ae6b-3ca1d98b4208

D/BtGatt.btif(10670): btif_gattc_register_app

D/BtGatt.btif(10670): btgattc_handle_event: Event 1000

D/BtGatt.btif(10670): btif_gattc_upstreams_evt: Event 0

D/BtGatt.GattService(10670): onClientRegistered() - UUID=3a123b89-8939-4d5b-ae6b-3ca1d98b4208, clientIf=5

E/MP-Decision( 2172): Error setting a sleep mode for secondary cores - -38

D/BluetoothGatt( 8804): onClientRegistered() - status=0 clientIf=5

D/BtGatt.GattService(10670): clientConnect() - address=20:73:20:00:6C:B4, isDirect=true

D/BtGatt.btif(10670): btif_gattc_open

D/BtGatt.btif(10670): btgattc_handle_event: Event 1004

D/BtGatt.btif(10670): btif_gattc_upstreams_evt: Event 2

D/BtGatt.GattService(10670): onConnected() - clientIf=5, connId=5, address=20:73:20:00:6C:B4

D/BluetoothGatt( 8804): onClientConnectionState() - status=0 clientIf=5 device=20:73:20:00:6C:B4

D/BluetoothGatt( 8804): discoverServices() - device: 20:73:20:00:6C:B4

D/BtGatt.GattService(10670): discoverServices() - address=20:73:20:00:6C:B4, connId=5

D/BtGatt.btif(10670): btif_gattc_search_service

D/BtGatt.btif(10670): btgattc_handle_event: Event 1006

V/BluetoothMasReceiver( 8128): BluetoothMasReceiver onReceive :android.bluetooth.device.action.BOND_STATE_CHANGED

V/BluetoothMasService( 8128): Map Service onStartCommand

V/BluetoothMasService( 8128): action: android.bluetooth.device.action.BOND_STATE_CHANGED

W/bt-smp (10670): loca

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值