Hi,最近刚接触安卓6.0蓝牙开发,遇到com.android.bluetooth 进程终止,请问我应该怎么从log分析,定位到问题原因或者异常代码位置。log:
11-05 14:34:45.262  2380  3741 D BluetoothHeadset: Proxy object disconnected
11-05 14:34:45.262  5608  5608 D BluetoothInputDevice: Proxy object disconnected
11-05 14:34:45.262  5608  5608 D HidProfile: Bluetooth service disconnected
11-05 14:34:45.262  5608  5608 D BluetoothA2dp: Proxy object disconnected
11-05 14:34:45.263  5608  5608 D BluetoothPan: BluetoothPAN Proxy object disconnected
11-05 14:34:45.263  5608  5608 D BluetoothPan: BluetoothPAN Proxy object disconnected
11-05 14:34:45.263  5608  5608 D PanProfile: Bluetooth service disconnected
11-05 14:34:45.263  5608  5608 D BluetoothPbap: Proxy object disconnected
11-05 14:34:45.263  5608  5608 D PbapServerProfile: Bluetooth service disconnected
11-05 14:34:45.263  5608  5608 D BluetoothMap: Proxy object disconnected
11-05 14:34:45.263  5608  5608 D MapProfile: Bluetooth service disconnected
11-05 14:34:45.263  2380  3737 D GraphicsStats: Buffer count: 17
11-05 14:34:45.263  5608  5626 D BluetoothHeadset: Proxy object disconnected
11-05 14:34:45.263  5608  5608 D HeadsetProfile: Bluetooth service disconnected
11-05 14:34:45.263   386  6470 V AudioFlinger: 13743 died, releasing its sessions
11-05 14:34:45.264   386  6470 V AudioFlinger:  pid 2380 @ 0
11-05 14:34:45.264   386  6470 V AudioFlinger:  pid 2380 @ 1
11-05 14:34:45.264   386  6470 V AudioFlinger:  pid 2380 @ 2
11-05 14:34:45.264   386  6470 V AudioFlinger:  pid 2380 @ 3
11-05 14:34:45.264   386  6470 V AudioFlinger:  pid 3379 @ 4
11-05 14:34:45.265 12055 12067 D BluetoothHeadset: Proxy object disconnected
11-05 14:34:45.265  3379  3609 D BluetoothHeadset: Proxy object disconnected
11-05 14:34:45.265  2380  3741 D BluetoothHeadset: Proxy object disconnected
11-05 14:34:45.265  2380  3741 D BluetoothHeadset: Proxy object disconnected
11-05 14:34:45.267  3379  3379 D BluetoothInputDevice: Proxy object disconnected
11-05 14:34:45.267  3379  3379 D HidProfile: Bluetooth service disconnected
11-05 14:34:45.267  3379  3379 D BluetoothA2dp: Proxy object disconnected
11-05 14:34:45.267  3379  3379 D BluetoothPan: BluetoothPAN Proxy object disconnected
11-05 14:34:45.267  3379  3379 D PanProfile: Bluetooth service disconnected
11-05 14:34:45.267  3379  3379 D BluetoothPbap: Proxy object disconnected
11-05 14:34:45.267  3379  3379 D PbapServerProfile: Bluetooth service disconnected
11-05 14:34:45.267  3379  3379 D BluetoothMap: Proxy object disconnected
11-05 14:34:45.267  3379  3379 D MapProfile: Bluetooth service disconnected
11-05 14:34:45.267  3379  3379 D HeadsetProfile: Bluetooth service disconnected
11-05 14:34:45.268  2380  2380 E BluetoothDevice: 
11-05 14:34:45.268  2380  2380 E BluetoothDevice: android.os.DeadObjectException
11-05 14:34:45.268  2380  2380 E BluetoothDevice: at android.os.BinderProxy.transactNative(Native Method)
11-05 14:34:45.268  2380  2380 E BluetoothDevice: at android.os.BinderProxy.transact(Binder.java:503)
11-05 14:34:45.268  2380  2380 E BluetoothDevice: at android.bluetooth.IBluetooth$Stub$Proxy.getRemoteClass(IBluetooth.java:1440)
11-05 14:34:45.268  2380  2380 E BluetoothDevice: at android.bluetooth.BluetoothDevice.getBluetoothClass(BluetoothDevice.java:1035)
11-05 14:34:45.268  2380  2380 E BluetoothDevice: at com.android.server.audio.AudioService.setBtScoDeviceConnectionState(AudioService.java:3039)
11-05 14:34:45.268  2380  2380 E BluetoothDevice: at com.android.server.audio.AudioService$2.onServiceDisconnected(AudioService.java:3235)
11-05 14:34:45.268  2380  2380 E BluetoothDevice: at android.bluetooth.BluetoothHeadset$3.handleMessage(BluetoothHeadset.java:1003)
11-05 14:34:45.268  2380  2380 E BluetoothDevice: at android.os.Handler.dispatchMessage(Handler.java:102)
11-05 14:34:45.268  2380  2380 E BluetoothDevice: at android.os.Looper.loop(Looper.java:148)
11-05 14:34:45.268  2380  2380 E BluetoothDevice: at com.android.server.SystemServer.run(SystemServer.java:283)
11-05 14:34:45.268  2380  2380 E BluetoothDevice: at com.android.server.SystemServer.main(SystemServer.java:168)
11-05 14:34:45.268  2380  2380 E BluetoothDevice: at java.lang.reflect.Method.invoke(Native Method)
11-05 14:34:45.268  2380  2380 E BluetoothDevice: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-05 14:34:45.268  2380  2380 E BluetoothDevice: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
11-05 14:34:45.269  2380  2380 E BluetoothDevice: 
11-05 14:34:45.269  2380  2380 E BluetoothDevice: android.os.DeadObjectException
11-05 14:34:45.269  2380  2380 E BluetoothDevice: at android.os.BinderProxy.transactNative(Native Method)
11-05 14:34:45.269  2380  2380 E BluetoothDevice: at android.os.BinderProxy.transact(Binder.java:503)
11-05 14:34:45.269  2380  2380 E BluetoothDevice: at android.bluetooth.IBluetooth$Stub$Proxy.getRemoteName(IBluetooth.java:1343)
11-05 14:34:45.269  2380  2380 E BluetoothDevice: at android.bluetooth.BluetoothDevice.getName(BluetoothDevice.java:726)
11-05 14:34:45.269  2380  2380 E BluetoothDevice: at com.android.server.audio.AudioService.setBtScoDeviceConnectionState(AudioService.java:3060)
11-05 14:34:45.269  2380  2380 E BluetoothDevice: at com.android.server.audio.AudioService$2.onServiceDisconnected(AudioService.java:3235)
11-05 14:34:45.269  2380  2380 E BluetoothDevice: at android.bluetooth.BluetoothHeadset$3.handleMessage(BluetoothHeadset.java:1003)
11-05 14:34:45.269  2380  2380 E BluetoothDevice: at android.os.Handler.dispatchMessage(Handler.java:102)
11-05 14:34:45.269  2380  2380 E BluetoothDevice: at android.os.Looper.loop(Looper.java:148)
11-05 14:34:45.269  2380  2380 E BluetoothDevice: at com.android.server.SystemServer.run(SystemServer.java:283)
11-05 14:34:45.269  2380  2380 E BluetoothDevice: at com.android.server.SystemServer.main(SystemServer.java:168)
11-05 14:34:45.269  2380  2380 E BluetoothDevice: at java.lang.reflect.Method.invoke(Native Method)
11-05 14:34:45.269  2380  2380 E BluetoothDevice: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-05 14:34:45.269  2380  2380 E BluetoothDevice: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
11-05 14:34:45.269  2380  2380 D BluetoothA2dp: Proxy object disconnected
11-05 14:34:45.269  2380  2380 D AudioService: mConnectedBTDevicesList size 1
11-05 14:34:45.269  2380  2380 D AudioService: checkSendBecomingNoisyIntent update the noise
11-05 14:34:45.269  2380  2558 E BluetoothManagerService: MESSAGE_BLUETOOTH_SERVICE_DISCONNECTED: 1
11-05 14:34:45.269  2380  2558 D BluetoothManagerService: Broadcasting onBluetoothServiceDown() to 5 receivers.
11-05 14:34:45.270   386  3895 V AudioFlinger: setParameters(): io 0, keyvalue A2dpSuspended=true, calling pid 2380
11-05 14:34:45.270   386  3895 D audio_hw_primary: adev_set_parameters: enter: A2dpSuspended=true
11-05 14:34:45.270   386  3895 E voice   : voice_extn_compress_voip_set_parameters: COMPRESS_VOIP_ENABLED is not defined
11-05 14:34:45.270   386  3895 V msm8916_platform: platform_set_parameters: enter: - A2dpSuspended=true
11-05 14:34:45.270   386  3895 V msm8916_platform: platform_set_parameters: exit with code(0)
11-05 14:34:45.270   386  3895 D audio_hw_extn: audio_extn_set_anc_parameters: anc_enabled:0
11-05 14:34:45.270   386  3895 V audio_hw_primary: adev_set_parameters: exit with code(0)
11-05 14:34:45.270   386  3895 I bt_a2dp_hw: adev_set_parameters: state 0
11-05 14:34:45.270   386  3895 I bt_a2dp_hw: out_set_parameters: state 0
11-05 14:34:45.270   386  3895 I str_params: key: 'A2dpSuspended' value: 'true'
11-05 14:34:45.364  2380  2559 W AppOps  : Finishing op nesting under-run: uid 1000 pkg android code 24 time=0 duration=0 nesting=0
11-05 14:34:45.475  2380  2418 E libprocessgroup: failed to kill 1 processes for processgroup 13743
11-05 14:34:45.476  2380  2418 I ActivityManager: Process com.android.bluetooth (pid 13743) has died

解决方案 »

  1.   

    这种情况出现,意味着你的蓝牙主进程crash了。Android系统会生成详细的crash信息。
    第一个是在logcat中搜索AndroidRuntime,看是否有com.android.bluetooth的报错。AndroidRuntime是Java层的代码异常所打印的错误信息,例如空指针引用等。
    第二个是在你的开发板的/data/tombstones目录下,查看tombstone文件。一般C/C++层代码出错,都会生成tombstone文件。每一个出错生成一个tombstone文件。所以可能会在该目录下看到多个。挨个打开查看,可以看到crash的地方,运气好还能看到函数栈,清晰地看到那个文件哪个函数出错了。如果看不到函数栈,在tombstone文件最下面还有crash时的logcat信息,可以从这里找找线索,看看哪里导致了crash。
      

  2.   

    这种情况出现,意味着你的蓝牙主进程crash了。Android系统会生成详细的crash信息。
    第一个是在logcat中搜索AndroidRuntime,看是否有com.android.bluetooth的报错。AndroidRuntime是Java层的代码异常所打印的错误信息,例如空指针引用等。
    第二个是在你的开发板的/data/tombstones目录下,查看tombstone文件。一般C/C++层代码出错,都会生成tombstone文件。每一个出错生成一个tombstone文件。所以可能会在该目录下看到多个。挨个打开查看,可以看到crash的地方,运气好还能看到函数栈,清晰地看到那个文件哪个函数出错了。如果看不到函数栈,在tombstone文件最下面还有crash时的logcat信息,可以从这里找找线索,看看哪里导致了crash。