开发者

Using HTML Parser in Android Project

I want to parse a HTML document in my Android project

I found many parsers and I want to use this HTML Parser

I really understand how it works and how I have to use it. But I'm not able to add the libraries right.

By adding the two jar-Files htmlparser.jar and htmllexxer.jar I get a compiling error:

Conversion to Dalvik format failed with error 1

I figured out that there's a conflict and so I added only one jar-file (the htmlparser.jar).

(btw. Internet connection is available) But the parsing throws me following exception:

08-15 20:58:45.662: ERROR/AndroidRuntime(386): FATAL EXCEPTION: main
08-15 20:58:45.662: ERROR/AndroidRuntime(386): java.lang.NoClassDefFoundError: org.htmlparser.Parser
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at com.mks_squadron.manager.communication.HTMLParser.parse(HTMLParser.java:15)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at com.mks_squadron.manager.StartActivity$1.onClick(StartActivity.java:30)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at android.view.View.performClick(View.java:2408)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at android.view.View$PerformClick.run(View.java:8816)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at android.os.Handler.handleCallback(Handler.java:587)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at android.os.Handler.dispatchMessage(Handler.java:92)
08-15 20:58:45.662: ERR开发者_运维知识库OR/AndroidRuntime(386):     at android.os.Looper.loop(Looper.java:123)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at android.app.ActivityThread.main(ActivityThread.java:4627)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at java.lang.reflect.Method.invokeNative(Native Method)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at java.lang.reflect.Method.invoke(Method.java:521)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at dalvik.system.NativeStart.main(Native Method)

So I didn't import the jar-files right. What am I doing wrong? Could someone please help me, importing the libaries right? Thanks alot!


Those libraries may not be supported by Android. Also I would suspect you need both of the jars for it to work.

Try using JSoup. It's really easy to use and easy to get up and running on Android.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜