I was working on a new Android project tonight when I came across an issue. In this application I am going to read an RSS feed and parse it out into a list of entries. The 1st thing I decided to do is go out and find a library to do this. No point in reinventing the wheel right. After a little searching I came across a great library called ROME

I whipped up a quick example to read in the rss feed. Unfortunately when I ran the example I got an error.

05-23 23:36:36.541: ERROR/AndroidRuntime(263): java.lang.NoClassDefFoundError: [Ljava.beans.PropertyDescriptor; 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at com.sun.syndication.feed.impl.BeanIntrospector.getPropertyDescriptors(BeanIntrospector.java:39) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at com.sun.syndication.feed.impl.ToStringBean.toString(ToStringBean.java:129) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at com.sun.syndication.feed.impl.ToStringBean.toString(ToStringBean.java:116) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at com.sun.syndication.feed.impl.ObjectBean.toString(ObjectBean.java:120) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at com.sun.syndication.feed.synd.SyndCategoryImpl.toString(SyndCategoryImpl.java:90) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at com.sun.syndication.feed.impl.EqualsBean.beanHashCode(EqualsBean.java:193) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at com.sun.syndication.feed.impl.ObjectBean.hashCode(ObjectBean.java:110) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at com.sun.syndication.feed.synd.SyndCategoryImpl.hashCode(SyndCategoryImpl.java:80) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at java.util.HashMap.put(HashMap.java:393) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at java.util.HashSet.add(HashSet.java:95) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at java.util.AbstractCollection.addAll(AbstractCollection.java:77) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at com.sun.syndication.feed.synd.impl.ConverterForRSS092.createSyndEntry(ConverterForRSS092.java:50) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at com.sun.syndication.feed.synd.impl.ConverterForRSS093.createSyndEntry(ConverterForRSS093.java:37) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at com.sun.syndication.feed.synd.impl.ConverterForRSS094.createSyndEntry(ConverterForRSS094.java:58) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at com.sun.syndication.feed.synd.impl.ConverterForRSS090.createSyndEntries(ConverterForRSS090.java:79) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at com.sun.syndication.feed.synd.impl.ConverterForRSS090.copyInto(ConverterForRSS090.java:64) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at com.sun.syndication.feed.synd.impl.ConverterForRSS091Userland.copyInto(ConverterForRSS091Userland.java:49) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at com.sun.syndication.feed.synd.impl.ConverterForRSS094.copyInto(ConverterForRSS094.java:47) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at com.sun.syndication.feed.synd.SyndFeedImpl.(SyndFeedImpl.java:144) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at com.sun.syndication.io.SyndFeedInput.build(SyndFeedInput.java:123) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at org.cfbloggers.android.ColdFusionBloggers.parse(ColdFusionBloggers.java:43) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at org.cfbloggers.android.ColdFusionBloggers.onCreate(ColdFusionBloggers.java:29) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at android.os.Handler.dispatchMessage(Handler.java:99) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at android.os.Looper.loop(Looper.java:123) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at android.app.ActivityThread.main(ActivityThread.java:4627) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at java.lang.reflect.Method.invokeNative(Native Method) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at java.lang.reflect.Method.invoke(Method.java:521) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 05-23 23:36:36.541: ERROR/AndroidRuntime(263): at dalvik.system.NativeStart.main(Native Method)

Of course I thought I was doing something wrong but it turns out I wasn't. I copied the same code over to a basic Java project taking Android out of the picture. The code ran as expected and at this point I was really confused. I did some searching and came across this article. Basically Android's version of Java has excluded some libraries from the language. One of those libraries is java.beans which the ROME project uses. So the error I was getting makes sense now and In the end I guess you just can't use ROME in an Android project. I will go on the hunt for another open source library that can parse a feed. If you know of one that will work with Android please let me know.