Question

I'm working on getting an app communicating with an external service in another application (called CSipSimple). I'm able to bind to the service:

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)

The exception is thrown on the indicated line. I've searched around and tried all of the following, to no avail:

  • Adding the AIDL files to the source folder of the project
  • Adding the other application (CSipSimple) as a required project
  • Check off all of the entries in the Order/Export list
  • Cleaning and rebuilding both applications

The following errors are generated:

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)

It looks like it can't find some of the required classes/methods, but I've added all of the AIDL files to my project. Any help would be greatly appreciated!

Was it helpful?

Solution

I was able to solve this by making SipHome a library, and including it in my application from the Project Properties -> Android -> Library dialog.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top