How can I use an external library correctly work on java but not on Android Activity

in my android application I need to use an external library to post a comment to a wordpress blog.
The library than I use is:
http://code.google.com/p/wordpress-java/

When I use it in a generic java program it work very well but when I use it in my Android Activity I have exception.

Read More

This is my LogCat:

06-21 15:23:24.820: I/dalvikvm(15546): Total arena pages for JIT: 21
06-21 15:23:24.820: I/dalvikvm(15546): Total arena pages for JIT: 22
06-21 15:23:24.825: I/dalvikvm(15546): Total arena pages for JIT: 23
06-21 15:23:24.825: I/dalvikvm(15546): Total arena pages for JIT: 24
06-21 15:23:24.825: I/dalvikvm(15546): Total arena pages for JIT: 25
06-21 15:23:24.825: I/dalvikvm(15546): Total arena pages for JIT: 26
06-21 15:23:24.825: I/dalvikvm(15546): Total arena pages for JIT: 27
06-21 15:23:24.825: I/dalvikvm(15546): Total arena pages for JIT: 28
06-21 15:23:24.825: I/dalvikvm(15546): Total arena pages for JIT: 29
06-21 15:23:24.825: I/dalvikvm(15546): Total arena pages for JIT: 30
06-21 15:23:24.825: I/dalvikvm(15546): Total arena pages for JIT: 31
06-21 15:23:24.825: I/dalvikvm(15546): Total arena pages for JIT: 32
06-21 15:23:24.825: I/dalvikvm(15546): Total arena pages for JIT: 33
06-21 15:23:24.825: I/dalvikvm(15546): Total arena pages for JIT: 34
06-21 15:23:24.825: I/dalvikvm(15546): Total arena pages for JIT: 35
06-21 15:23:24.825: I/dalvikvm(15546): Total arena pages for JIT: 36
06-21 15:23:24.825: I/dalvikvm(15546): Total arena pages for JIT: 37
06-21 15:23:24.825: I/dalvikvm(15546): Total arena pages for JIT: 38
06-21 15:23:24.825: I/dalvikvm(15546): Total arena pages for JIT: 39
06-21 15:23:24.825: I/dalvikvm(15546): Total arena pages for JIT: 40
06-21 15:23:24.930: D/dalvikvm(15546): GC_CONCURRENT freed 390K, 8% free  12443K/13447K, paused 12ms+12ms, total 34ms
06-21 15:23:25.065: D/dalvikvm(15546): GC_CONCURRENT freed 481K, 8% free 12448 K/13511K, paused 12ms+11ms, total 42ms
06-21 15:23:25.205: D/dalvikvm(15546): GC_CONCURRENT freed 444K, 8% free  12482K/13511K, paused 1ms+1ms, total 18ms
06-21 15:23:25.320: D/dalvikvm(15546): GC_CONCURRENT freed 474K, 8% free  12491K/13575K, paused 2ms+11ms, total 33ms
06-21 15:23:25.455: D/dalvikvm(15546): GC_CONCURRENT freed 490K, 8% free 12504K/13575K, paused 12ms+12ms, total 44ms
06-21 15:23:25.590: D/dalvikvm(15546): GC_CONCURRENT freed 458K, 9% free 12542K/13639K, paused 2ms+11ms, total 30ms
06-21 15:23:25.725: D/dalvikvm(15546): GC_CONCURRENT freed 483K, 8% free 12561K/13639K, paused 1ms+16ms, total 47ms
06-21 15:23:25.910: D/dalvikvm(15546): GC_CONCURRENT freed 549K, 9% free   12578K/13703K, paused 4ms+1ms, total 37ms
06-21 15:23:25.910: D/dalvikvm(15546): WAIT_FOR_CONCURRENT_GC blocked 5ms
06-21 15:23:26.070: D/dalvikvm(15546): GC_CONCURRENT freed 454K, 9% free 12600K/13703K, paused 12ms+11ms, total 49ms
06-21 15:23:26.345: D/dalvikvm(15546): GC_CONCURRENT freed 330K, 8% free  12683K/13703K, paused 13ms+12ms, total 42ms
06-21 15:23:26.590: D/dalvikvm(15546): GC_FOR_ALLOC freed 242K, 7% free 12815K/13767K, paused 25ms, total 25ms
06-21 15:23:27.810: I/Choreographer(15546): Skipped 77 frames!  The application may be doing too much work on its main thread.
06-21 15:23:31.345: D/dalvikvm(15546): GC_FOR_ALLOC freed 338K, 8% free 12934K/13959K, paused 18ms, total 18ms
06-21 15:23:31.375: D/dalvikvm(15546): GC_CONCURRENT freed 2K, 8% free 12947K/13959K, paused 12ms+2ms, total 27ms
06-21 15:23:31.595: D/dalvikvm(15546): GC_FOR_ALLOC freed <1K, 8% free 12947K/13959K, paused 44ms, total 44ms
06-21 15:23:31.600: I/dalvikvm-heap(15546): Grow heap (frag case) to 14.134MB for 977464-byte allocation
06-21 15:23:31.635: D/dalvikvm(15546): GC_CONCURRENT freed 0K, 7% free 13901K/14919K, paused 12ms+2ms, total 35ms
06-21 15:23:31.635: D/dalvikvm(15546): WAIT_FOR_CONCURRENT_GC blocked 22ms
06-21 15:23:32.400: E/SpannableStringBuilder(15546): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
06-21 15:23:32.400: E/SpannableStringBuilder(15546): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
06-21 15:23:35.755: I/dalvikvm(15546): Could not find method java.beans.Introspector.getBeanInfo, referenced from method redstone.xmlrpc.serializers.IntrospectingSerializer.serialize
06-21 15:23:35.755: W/dalvikvm(15546): VFY: unable to resolve static method 6817: Ljava/beans/Introspector;.getBeanInfo (Ljava/lang/Class;Ljava/lang/Class;)Ljava/beans/BeanInfo;
06-21 15:23:35.755: D/dalvikvm(15546): VFY: replacing opcode 0x71 at 0x0015
06-21 15:23:35.955: D/dalvikvm(15546): GC_CONCURRENT freed 417K, 7% free 14015K/15047K, paused 12ms+3ms, total 29ms
06-21 15:23:36.770: D/AndroidRuntime(15546): Shutting down VM
06-21 15:23:36.770: W/dalvikvm(15546): threadid=1: thread exiting with uncaught exception (group=0x40ed42a0)
06-21 15:23:36.790: E/AndroidRuntime(15546): FATAL EXCEPTION: main
06-21 15:23:36.790: E/AndroidRuntime(15546): java.lang.RuntimeException: Unable to start activity ComponentInfo{rss.activity/rss.activity.CommentaArticolo}: redstone.xmlrpc.XmlRpcException: The response could not be parsed.
06-21 15:23:36.790: E/AndroidRuntime(15546):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at android.app.ActivityThread.access$600(ActivityThread.java:140)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at android.os.Handler.dispatchMessage(Handler.java:99)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at android.os.Looper.loop(Looper.java:137)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at android.app.ActivityThread.main(ActivityThread.java:4898)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at java.lang.reflect.Method.invokeNative(Native Method)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at java.lang.reflect.Method.invoke(Method.java:511)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at dalvik.system.NativeStart.main(Native Method)
06-21 15:23:36.790: E/AndroidRuntime(15546): Caused by: redstone.xmlrpc.XmlRpcException: The response could not be parsed.
06-21 15:23:36.790: E/AndroidRuntime(15546):    at redstone.xmlrpc.XmlRpcClient.handleResponse(Unknown Source)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at redstone.xmlrpc.XmlRpcClient.endCall(Unknown Source)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at redstone.xmlrpc.XmlRpcClient.invoke(Unknown Source)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at redstone.xmlrpc.XmlRpcProxy.invoke(Unknown Source)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at net.bican.wordpress.$Proxy1.getRecentPosts(Native Method)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at net.bican.wordpress.Wordpress.getRecentPosts(WordPress.java:497)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at rss.util.MyWordpress.getPostIDFromURL(MyWordpress.java:33)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at rss.activity.CommentaArticolo.onCreate(CommentaArticolo.java:38)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at   android.app.Activity.performCreate(Activity.java:5206)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
06-21 15:23:36.790: E/AndroidRuntime(15546):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
06-21 15:23:36.790: E/AndroidRuntime(15546):    ... 11 more
06-21 15:23:36.790: E/AndroidRuntime(15546): Caused by: redstone.xmlrpc.XmlRpcException: Could not instantiate XMLReader parser
06-21 15:23:36.790: E/AndroidRuntime(15546):    at redstone.xmlrpc.XmlRpcParser.parse(Unknown Source)
06-21 15:23:36.790: E/AndroidRuntime(15546):    ... 22 more
06-21 15:23:36.790: E/AndroidRuntime(15546): Caused by: org.xml.sax.SAXException: Can't create default XMLReader; is system property org.xml.sax.driver set?
06-21 15:23:36.790: E/AndroidRuntime(15546):    at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:156)
06-21 15:23:36.790: E/AndroidRuntime(15546):    ... 23 more

Related posts

Leave a Reply

1 comment

  1. The bottom exceptions on that stack trace look to be the source of your issues. It looks like the WordPress library is using redstone-xmlrpc and it would seem that it is trying to use an XMLReader, or at the very least you are tying to use one.

    Caused by: org.xml.sax.SAXException: Can't create default XMLReader; is system property org.xml.sax.driver set?
    

    This link will likely help you, it’s an SO question relating to porting code from Java to Android, but he was having the same error.

    porting to Android: why am I getting “Can’t create default XMLReader; is system property org.xml.sax.driver set?”?

    Although, it would seem that the XML portion of your code is built in to the WordPress library, which probably means that you can’t fix it to work with Android. But you never know, there may be a constructor that will allow you to pass a custom XMLReader for use with the library.

    It might be worth it to contact WordPress and see what they have to say about porting their code to Android, it isn’t unheard of for developers to work with people such as yourself to complete a task that they either can’t work on, or won’t.

    Also, check for source code, perhaps you can track it down and modify the library so that it will suit your needs (But depending on the licensing you may not want to do this).