2013-06-04 89 views
1

我正在努力使應用程序在另一個應用程序(稱爲CSipSimple)中與外部服務進行通信。我可以綁定到服務:AIDL服務的java.lang.VerifyError

ServiceConnection mConnection = new ServiceConnection(){ 
    @Override 
    public void onServiceConnected(ComponentName comp, IBinder svc){ 
     ISipService mSvc = ISipService.Stub.asInterface(svc); // Exception here 
     ... 
    } 
    ... 
} 

Intent i = new Intent("com.csipsimple.service.SipService"); 
getApplicationContext().bindService(i, mConnection, BIND_IMPORTANT) 

在指定的行上引發異常。我已搜索周圍,嘗試了所有的以下的,都無濟於事:

  • 添加AIDL文件到項目
  • 添加其他應用程序(CSipSimple)作爲必需項目的源文件夾
  • 檢查了所有的條目中的訂單/導出列表
  • 清洗和重建這兩個應用程序

生成以下錯誤:

06-04 12:01:25.320: W/dalvikvm(8631): VFY: unable to resolve virtual method 4276: Lcom/csipsimple/api/SipCallSession;.writeToParcel (Landroid/os/Parcel;I)V 
06-04 12:01:25.320: W/dalvikvm(8631): VFY: unable to find class referenced in signature ([Lcom/csipsimple/api/SipCallSession;) 
06-04 12:01:25.320: W/dalvikvm(8631): VFY: [Ljava/lang/Object; is not instance of [Landroid/os/Parcelable; 
06-04 12:01:25.320: W/dalvikvm(8631): VFY: bad arg 1 (into [Landroid/os/Parcelable;) 
06-04 12:01:25.320: W/dalvikvm(8631): VFY: rejecting call to Landroid/os/Parcel;.writeTypedArray ([Landroid/os/Parcelable;I)V 
06-04 12:01:25.320: W/dalvikvm(8631): VFY: rejecting opcode 0x6e at 0x01dc 
06-04 12:01:25.320: W/dalvikvm(8631): VFY: rejected Lcom/csipsimple/api/ISipService$Stub;.onTransact (ILandroid/os/Parcel;Landroid/os/Parcel;I)Z 
06-04 12:01:25.320: W/dalvikvm(8631): Verifier rejected class Lcom/csipsimple/api/ISipService$Stub; 
06-04 12:01:25.320: W/dalvikvm(8631): threadid=1: thread exiting with uncaught exception (group=0x4191d930) 
06-04 12:01:25.328: E/AndroidRuntime(8631): FATAL EXCEPTION: main 
06-04 12:01:25.328: E/AndroidRuntime(8631): java.lang.VerifyError: com/csipsimple/api/ISipService$Stub 
06-04 12:01:25.328: E/AndroidRuntime(8631):  at com.example.sipgather.MainActivity$1.onServiceConnected(MainActivity.java:37) 
06-04 12:01:25.328: E/AndroidRuntime(8631):  at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1101) 
06-04 12:01:25.328: E/AndroidRuntime(8631):  at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1118) 
06-04 12:01:25.328: E/AndroidRuntime(8631):  at android.os.Handler.handleCallback(Handler.java:725) 
06-04 12:01:25.328: E/AndroidRuntime(8631):  at android.os.Handler.dispatchMessage(Handler.java:92) 
06-04 12:01:25.328: E/AndroidRuntime(8631):  at android.os.Looper.loop(Looper.java:137) 
06-04 12:01:25.328: E/AndroidRuntime(8631):  at android.app.ActivityThread.main(ActivityThread.java:5041) 
06-04 12:01:25.328: E/AndroidRuntime(8631):  at java.lang.reflect.Method.invokeNative(Native Method) 
06-04 12:01:25.328: E/AndroidRuntime(8631):  at java.lang.reflect.Method.invoke(Method.java:511) 
06-04 12:01:25.328: E/AndroidRuntime(8631):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
06-04 12:01:25.328: E/AndroidRuntime(8631):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 
06-04 12:01:25.328: E/AndroidRuntime(8631):  at dalvik.system.NativeStart.main(Native Method) 

看起來它無法找到一些必需的類/方法,但我已將所有AIDL文件添加到我的項目中。任何幫助將不勝感激!

+0

看起來像'ISipService.Stub.onTransact(Parcel,Parcel,int)'傳遞'Object []'到'Parcel.writeTypedArray(Parcelable [])'。缺少方法和類通常會導致運行時失敗(「沒有這種方法」),而不是立即驗證失敗,所以第一對失敗消息可能不是致命的。 – fadden

回答

0

我能夠通過製作SipHome庫來解決這個問題,並將其包含在我的應用程序中,該對話框爲Project Properties -> Android -> Library