藍牙連接異常,報錯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後異常解決


完~

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章