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:
These and many other classes in java.beans package are missing from the Android API. I see a few solutions:
- Get my project not depend on any java.beans classes. This is problematic as the code depends on the java.beans package heavily.
- 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.
- 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?