Search code examples
javaandroidprocessipcaidl

Error while updating AIDL to next revision


i am creating a new aidl service, which will be used by 3rd party and facing one problem while updating the AIDL file in server side. suppose. Server AIDL file rivison 1: one API is there 1. Add(int a, int b)

Client AIDL file Rivision 1: one api is there 1. Add(int a, int b)

now i have updated the server AIDL Server AIDL file rivision 2: two APIs are there 1. Subtract(int a, int b); 2. Add(int a, int b);

when i am running my second rivision server with first revision client instead of calling add it is calling subtract method.. is there any solution to this problem ? is it a restriction from android that both Server and client end AIDL function order should be same.??


Solution

  • Yes, the AIDL interfaces on the Server and on the Clint sides must be synchronized. AIDL file is just an interface the implementations of which on the client and server side are generated during the compilation of your client and server code. This interface defines how to marshal the calls from client to server, thus, if your interfaces are not synchronized on the client and on the server you'll get the problems in marshalling calls (this is the problem you see in your case).

    It is better to create a library that contains the AIDL interface as a separate project and attach it to your client and server projects. Thus, you'll have the same AIDL interface for both projects.