I am working on AIDL. My .aidl file is in another project(another application). Suppose the aidl file name is IService.aidl. But I get this error(shown below) on onServiceConnected(ComponentName componentName, IBinder iBinder) method while assigning
IService service = IService.Stub.asInterface((IBinder)iBinder);
1.What can be the problem?
2.Also how to access IService(aidl) of another project?
03-03 13:11:42.184: E/AndroidRuntime(2558): FATAL EXCEPTION: main
03-03 13:11:42.184: E/AndroidRuntime(2558): java.lang.NoClassDefFoundError: aexp.aidl.IService$Stub
03-03 13:11:42.184: E/AndroidRuntime(2558): at com.test.aidlclient.AIDLClientDemoActivity$AdditionServiceConnection.onServiceConnected(AIDLClientDemoActivity.java:72)
03-03 13:11:42.184: E/AndroidRuntime(2558): at android.app.ActivityThread$PackageInfo$ServiceDispatcher.doConnected(ActivityThread.java:1247)
03-03 13:11:42.184: E/AndroidRuntime(2558): at android.app.ActivityThread$PackageInfo$ServiceDispatcher$RunConnection.run(ActivityThread.java:1264)
03-03 13:11:42.184: E/AndroidRuntime(2558): at android.os.Handler.handleCallback(Handler.java:587)
03-03 13:11:42.184: E/AndroidRuntime(2558): at android.os.Handler.dispatchMessage(Handler.java:92)
03-03 13:11:42.184: E/AndroidRuntime(2558): at android.os.Looper.loop(Looper.java:123)
03-03 13:11:42.184: E/AndroidRuntime(2558): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-03 13:11:42.184: E/AndroidRuntime(2558): at java.lang.reflect.Method.invokeNative(Native Method)
03-03 13:11:42.184: E/AndroidRuntime(2558): at java.lang.reflect.Method.invoke(Method.java:521)
03-03 13:11:42.184: E/AndroidRuntime(2558): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
03-03 13:11:42.184: E/AndroidRuntime(2558): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
03-03 13:11:42.184: E/AndroidRuntime(2558): at dalvik.system.NativeStart.main(Native Method)
You have to copy aidl file to your current project. Then you have to check if java class was generated for this aidl file. I think that you did not include aidl file in your current client. If this did not help you try to clean your client project.