获取java.lang.IllegalStateException:活页夹已完成!当调用断开()或关闭()android.bluetooth.BluetoothGatt时

Dam*_*k5f 6 android bluetooth bluetooth-lowenergy

我有使用BluetoothGatt.java的 Android应用程序。

有时会崩溃的代码块(无法重现,但发生在用户身上):

mBluetoothGatt.disconnect();
mBluetoothGatt.close();
mBluetoothGatt = null;
Run Code Online (Sandbox Code Playgroud)

断开连接的堆栈跟踪:

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)
Run Code Online (Sandbox Code Playgroud)

通过断开连接但在close()崩溃时的堆栈跟踪

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)
Run Code Online (Sandbox Code Playgroud)

崩溃会在各种设备和android版本上出现。代码始终在应用程序的主线程上执行

对于可能引起问题的任何提示,我将不胜感激。