RSS

Android API and java.beans package

25 Aug

Android API mirrors the official JDK so closely that it’s easy to forget it’s not the official JDK. I was reminded of today when I started testing my project on Android. When I ran the project, I got a “java.lang.VerifyError” which didn’t make much sense at first but after further debugging, I realized that my project needed some classes from JDK’s java.beans package, namely:

  • java.beans.BeanInfo
  • java.beans.IntrospectionException
  • java.beans.Introspector
  • java.beans.PropertyDescriptor

These and many other classes in java.beans package are missing from the Android API. I see a few solutions:

  1. Get my project not depend on any java.beans classes. This is problematic as the code depends on the java.beans package heavily.
  2. Look into Apache Harmony. I’ve read in some forum that they have beans.jar that could help but couldn’t get my hands on it yet and not sure if it’ll work with Android’s Dalvik without too much pain.
  3. Copy JDK’s source for the java.beans classes that I need into my project and compile them with Dalvik. I’m not sure if this is permitted or whether it’d work but it’s worth a try, I suppose.

Any other solutions?

About these ads
 
2 Comments

Posted by on August 25, 2010 in Android, Java

 

Tags:

2 responses to “Android API and java.beans package

  1. Charles Gunn

    November 12, 2010 at 4:23 pm

    I just got bit by the same problem. Any progress on a work-around?

     
  2. Charles Gunn

    November 12, 2010 at 4:27 pm

    Just read your second post (from sept. 28). Thanks for sharing the fix!

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: