Flutter_blue: Connnect BLE devcie error, under flutter v1.5.9 pre147

Created on 8 May 2019  路  15Comments  路  Source: pauldemarco/flutter_blue

I run the example under latest flutter (1.5.9 pre147) version, met an error.

SCAN action is ok, the problem occurred while click CONNECT button.

detail error message as below:

D/BluetoothGatt( 4136): onClientConnectionState() - status=0 clientIf=5 device=10:CE:A9:2F:73:3F
D/FlutterBluePlugin( 4136): [onConnectionStateChange] status: 0 newState: 2
W/BluetoothGatt( 4136): Unhandled exception in callback
W/BluetoothGatt( 4136): java.lang.RuntimeException: Methods marked with @UiThread must be executed on the main thread. Current thread: Binder:4136_3
W/BluetoothGatt( 4136):     at io.flutter.embedding.engine.FlutterJNI.ensureRunningOnMainThread(FlutterJNI.java:605)
W/BluetoothGatt( 4136):     at io.flutter.embedding.engine.FlutterJNI.dispatchPlatformMessage(FlutterJNI.java:515)
W/BluetoothGatt( 4136):     at io.flutter.embedding.engine.dart.DartMessenger.send(DartMessenger.java:74)
W/BluetoothGatt( 4136):     at io.flutter.embedding.engine.dart.DartExecutor.send(DartExecutor.java:163)
W/BluetoothGatt( 4136):     at io.flutter.view.FlutterNativeView.send(FlutterNativeView.java:152)
W/BluetoothGatt( 4136):     at io.flutter.plugin.common.MethodChannel.invokeMethod(MethodChannel.java:95)
W/BluetoothGatt( 4136):     at io.flutter.plugin.common.MethodChannel.invokeMethod(MethodChannel.java:82)
W/BluetoothGatt( 4136):     at com.pauldemarco.flutterblue.FlutterBluePlugin$8.onConnectionStateChange(FlutterBluePlugin.java:757)
W/BluetoothGatt( 4136):     at android.bluetooth.BluetoothGatt$1$4.run(BluetoothGatt.java:262)
W/BluetoothGatt( 4136):     at android.bluetooth.BluetoothGatt.runOrQueueCallback(BluetoothGatt.java:770)
W/BluetoothGatt( 4136):     at android.bluetooth.BluetoothGatt.access$200(BluetoothGatt.java:39)
W/BluetoothGatt( 4136):     at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:257)
W/BluetoothGatt( 4136):     at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:71)
W/BluetoothGatt( 4136):     at android.os.Binder.execTransact(Binder.java:735)
D/BluetoothManager( 4136): getConnectionState()
D/BluetoothManager( 4136): getConnectedDevices
I/flutter ( 4136): State refreshed: BluetoothDeviceState.connected
D/BluetoothGatt( 4136): onConnectionUpdated() - Device=10:CE:A9:2F:73:3F interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt( 4136): onConnectionUpdated() - Device=10:CE:A9:2F:73:3F interval=36 latency=0 timeout=500 status=0
D/BluetoothGatt( 4136): close()
D/BluetoothGatt( 4136): unregisterApp() - mClientIf=5

flutter_blue: 0.5(git: 6f6fa30d77c7d935)

Any one can give some advice, thank you!

Most helpful comment

I am using flutter 1.7.8 with the fixed flutter_blue 0.5 version of https://github.com/bpillon/flutter_blue.

All 15 comments

I'm having the same issue

any fix yet?

any solution to this yet please?

I downgrade flutter to v1.3.0 and it works, code here ------> http://sayaw.net/main_dart.txt

the warning maybe coursed by this flutter engine patch: https://github.com/flutter/engine/commit/2c9e37c34e79475bbde7c8163eb5e56cdb9662a1

I downgrade flutter to v1.3.0 and it works, code here ------> http://sayaw.net/main_dart.txt

I also have the same problem and get the same message as @guixue.

Unfortunately, your solution did not work for me. Do you or anyone else have another suggestions to solve this issue?

Thanks!

Well, I had to use this https://pub.dev/packages/blue_thermal_printer. works for only android

Because now flutter will check if the data passing out from MainThread

@pauldemarco I have the same problem under the lastest version(1.7.3), I look forward to your solving this problem as soon as possible!

Same issue here, will they fix this in this plugin?

Is there now a solution for using flutter 1.7.8 with flutter_blue: 0.5 ?
At the moment I am going back to flutter 1.2.1.

All of a sudden I started experiencing this... Is there a fix or do we just downgrade flutter?

I am using flutter 1.7.8 with the fixed flutter_blue 0.5 version of https://github.com/bpillon/flutter_blue.

This should be resolved in the version as of June 19.
If not, please re-open the issue.

Was this page helpful?
0 / 5 - 0 ratings