Получение java.lang.IllegalStateException: Binder был завершен! при вызове метода connect () или close () android.bluetooth.BluetoothGatt - PullRequest
6 голосов
/ 28 марта 2019

У меня есть приложение Android, использующее BluetoothGatt.java .

Блок кода, который иногда падает (не может воспроизвести его, но происходит с пользователями):

mBluetoothGatt.disconnect();
mBluetoothGatt.close();
mBluetoothGatt = null;

Трассировка стека для отключения:

Fatal Exception: java.lang.IllegalStateException: Binder has been finalized!
   at android.os.BinderProxy.transactNative(Binder.java)
   at android.os.BinderProxy.transact(Binder.java:503)
   at android.bluetooth.IBluetoothGatt$Stub$Proxy.clientDisconnect(IBluetoothGatt.java:925)
   at android.bluetooth.BluetoothGatt.disconnect(BluetoothGatt.java:754)

Трассировка стека, когда он проходит разъединение, но происходит сбой при закрытии ()

Fatal Exception: java.lang.IllegalStateException: Binder has been finalized!
   at android.os.BinderProxy.transactNative(BinderProxy.java)
   at android.os.BinderProxy.transact(BinderProxy.java:503)
   at android.bluetooth.IBluetoothGatt$Stub$Proxy.unregisterClient(IBluetoothGatt.java:891)
   at android.bluetooth.BluetoothGatt.unregisterApp(BluetoothGatt.java:692)
   at android.bluetooth.BluetoothGatt.close(BluetoothGatt.java:631)

Сбои появляются на устройствах широкого диапазона и версиях Android.Код всегда выполняется в главном потоке приложения

Буду признателен за любые советы о том, что может быть причиной.

...