蓝牙连接异常,报错The application may be doing too much work on its main thread.

W/BluetoothAdapter: getBluetoothService() called with no BluetoothManagerCallback
W/System.err: java.io.IOException: read failed, socket might closed or timeout, read ret: -1
W/System.err:     at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:741)
W/System.err:     at android.bluetooth.BluetoothSocket.readInt(BluetoothSocket.java:753)
W/System.err:     at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:375)
W/System.err:     at com.joey.bluetoothdemo.util.ClientUtil.connectToServer(ClientUtil.java:38)
W/System.err:     at com.joey.bluetoothdemo.MainActivity$1.onItemClick(MainActivity.java:96)
W/System.err:     at android.widget.AdapterView.performItemClick(AdapterView.java:310)
W/System.err:     at android.widget.AbsListView.performItemClick(AbsListView.java:1155)
W/System.err:     at android.widget.AbsListView$PerformClick.run(AbsListView.java:3148)
W/System.err:     at android.widget.AbsListView$3.run(AbsListView.java:4091)
W/System.err:     at android.os.Handler.handleCallback(Handler.java:754)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
W/System.err:     at android.os.Looper.loop(Looper.java:163)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6342)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)
D/ClientUtil: connectToServer: 蓝牙连接异常
I/Choreographer: Skipped 311 frames!  The application may be doing too much work on its main thread.
I/Toast: Show toast from OpPackageName:com.joey.bluetoothdemo, PackageName:com.joey.bluetoothdemo, content:选择 H-C-2010-06-01


问题:

原本想为蓝牙连接新开一个线程,但是方法调用时应该调用start()方法却错调用了run()

The application may be doing too much work on its main thread.
解决:

run改成start后异常解决


完~

你可能感兴趣的:(Android)