我正在努力让应用程序与另一个应用程序(称为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)
在指定的行上抛出异常。我一直在搜索并尝试以下所有内容,但无济于事:
生成以下错误:
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 :(得分:0)
我能够通过使SipHome
成为库来解决这个问题,并将其包含在Project Properties -> Android -> Library
对话框的应用程序中。