最近蓝牙出现了一个无厘头的问题,build完系统之后,蓝牙pair是没问题的,但是传输数据就有问题了,出现下面的log:
I/dalvikvm( 2869): Failed resolving Lcom/android/bluetooth/pbap/BluetoothPbapAuthenticator; interface 510 'Ljavax/obex/Authenticator;'
W/dalvikvm( 2869): VFY: unable to find class referenced in signature (Ljavax/obex/ServerSession;)
W/dalvikvm( 2869): VFY: unable to find class referenced in signature (Ljavax/obex/ServerSession;)
W/dalvikvm( 2869): VFY: unable to find class referenced in signature (Ljavax/obex/ServerSession;)
I/dalvikvm( 2869): Could not find method javax.obex.ServerSession.close, referenced from method com.android.bluetooth.pbap.BluetoothPbapService.closeService
W/dalvikvm( 2869): VFY: unable to resolve virtual method 3599: Ljavax/obex/ServerSession;.close ()V
I/dalvikvm( 2869): Failed resolving Lcom/android/bluetooth/pbap/BluetoothPbapAuthenticator; interface 510 'Ljavax/obex/Authenticator;'
I/dalvikvm( 2869): Failed resolving Lcom/android/bluetooth/pbap/BluetoothPbapAuthenticator; interface 510 'Ljavax/obex/Authenticator;'
I/dalvikvm( 2869): Failed resolving Lcom/android/bluetooth/pbap/BluetoothPbapAuthenticator; interface 510 'Ljavax/obex/Authenticator;'
I/dalvikvm( 2869): Failed resolving Lcom/android/bluetooth/pbap/BluetoothPbapAuthenticator; interface 510 'Ljavax/obex/Authenticator;'
I/dalvikvm( 2869): Failed resolving Lcom/android/bluetooth/pbap/BluetoothPbapAuthenticator; interface 510 'Ljavax/obex/Authenticator;'
I/dalvikvm( 2869): Failed resolving Lcom/android/bluetooth/pbap/BluetoothPbapAuthenticator; interface 510 'Ljavax/obex/Authenticator;'
I/dalvikvm( 2869): Failed resolving Lcom/android/bluetooth/pbap/BluetoothPbapAuthenticator; interface 510 'Ljavax/obex/Authenticator;'
I/dalvikvm( 2869): Failed resolving Lcom/android/bluetooth/pbap/BluetoothPbapAuthenticator; interface 510 'Ljavax/obex/Authenticator;'
I/dalvikvm( 2869): Could not find method javax.obex.ServerSession.close, referenced from method com.android.bluetooth.pbap.BluetoothPbapService.stopObexServerSession
一开始还以为真的是obex这个库出问题了,和其他有冲突? 没build进去? 结果都不是,obex没有任何修改,也看不到有什么问题。
找com/android/bluetooth/pbap/BluetoothPbapAuthenticator.java,也没发现它调用到obex没有的函数,因为连它都没改过,郁闷了我一整天,最后再仔细看看bluetooth这个apk到底修改了什么发现:
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -17,6 +17,11 @@
android:description="@string/permdesc_bluetoothWhitelist"
android:protectionLevel="signature" />
+ <permission android:name="android.permission.ACCESS_FM_RECEIVER"
+ android:permissionGroup="android.permission-group.NETWORK"
+ android:protectionLevel="normal"
+ android:description="@string/permdesc_fm_receiver"
+ android:label="@string/permlab_fm_receiver" />
<!-- Allows receiving handover status broadcasts from Bluetooth -->,
<permission android:name="com.android.permission.HANDOVER_STATUS"
android:label="@string/permlab_handoverStatus"
@@ -50,6 +55,9 @@
<uses-permission android:name="android.permission.MANAGE_USERS"/>
<uses-permission android:name="com.google.android.gallery3d.permission.GALLERY_PROVIDER"/>
<uses-permission android:name="com.android.gallery3d.permission.GALLERY_PROVIDER"/>
+ <!-- For FM -->
+ <uses-permission android:name="android.permission.ACCESS_FM_RECEIVER" />
+
<!-- For PBAP Owner Vcard Info -->
<uses-permission android:name="android.permission.READ_PROFILE"/>
@@ -58,6 +66,7 @@
android:icon="@drawable/bt_share"
android:persistent="false"
android:label="@string/app_name">
+ <uses-library android:name="com.broadcom.bt" />
<uses-library android:name="javax.obex" />
<provider android:name=".opp.BluetoothOppProvider"
android:authorities="com.android.bluetooth.opp"
增加了一个依赖com.broadcom.bt,结果是这个依赖没有build到target里面去。把它build到target之后问题解决。