1

我正在努力让应用程序与另一个应用程序(称为 CSipSimple)中的外部服务进行通信。我能够绑定到服务:

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 文件添加到我的项目中。任何帮助将不胜感激!

4

1 回答 1

0

我可以通过创建SipHome一个库并将其从Project Properties -> Android -> Library对话框中包含在我的应用程序中来解决这个问题。

于 2013-06-04T20:47:10.820 回答