Monday, November 29, 2010

NoSuchMethodError in Android AIDL

Finally a good start of Monday :-). Resolved a weird problem of Android Framework which was disturbing me through out the weekend. One of my team mate (Sandeep) did exceptional R&D and helped me to come to this conclusion.

[Problem]
NoSuchMethodError exception while I was trying to access ISnsRequester.aidl of SNSProvider.
In Android 2.2 (Froyo) some of the method definitions of ISnsRequester.aidl file has been changed. A new input argument targetSubID has been added to commentPost() and commentRetrieve() methods.
But in our Android source code repository by mistake Telephony framework was still using older version of ISnsRequester.aidl (i.e. of Android 2.1).
This was the main cause of this problem.

For all framework classes/packages Android build system (when you try to make a binary) makes entry into Android\frameworks\base\api\current.xml In fact current.xml acts as Look up for any method or class reference. Thus definition of  commentPost() and commentRetrieve() methods were conflicting between current.xml and latest AIDL in SNSProvider. When my code was trying to call commentPost() and commentRetrieve() methods, being the look up for Framework, current.xml is being searched for the method definition instead of latest AIDL in SNSProvider. This was causing force close with NoSuchMethodError exception.

[Conclusion]
If any AIDL is part of Android Frmaework be careful about any duplicated resource or method definition conflicts and verify the current.xml after build is over.


Huh it really made me Nuts...:-D

No comments:

Post a Comment