HtmlUnit Android 错误

发布于 2024-11-11 14:32:31 字数 1670 浏览 5 评论 0原文

这是我第一次使用 HtmlUnit,并且我在 Android SDK 中使用它(不确定这是否可能,如果可以,请立即停止我)

所以我不断收到似乎链接到 WebClient 的错误:

06-01 22:46:58.939: ERROR/AndroidRuntime(351): Uncaught handler: thread main exiting due to uncaught exception
06-01 22:46:58.969: ERROR/AndroidRuntime(351): java.lang.NoClassDefFoundError: com.gargoylesoftware.htmlunit.DefaultCssErrorHandler
06-01 22:46:58.969: ERROR/AndroidRuntime(351):     at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:154)
06-01 22:46:58.969: ERROR/AndroidRuntime(351):     at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:176)
06-01 22:46:58.969: ERROR/AndroidRuntime(351):     at com.laytproducts.songmaster.mainAct.showResults(mainAct.java:107)
06-01 22:46:58.969: ERROR/AndroidRuntime(351):     at com.laytproducts.songmaster.mainAct$1.onClick(mainAct.java:90)

这是我的方法它指的是:

public void showResults(String endText) throws Exception{
        WebClient webClient = new WebClient(); //ERROR ON THIS LINE
        HtmlPage page = webClient.getPage(baseSite+endText);
        HtmlTable resultsT = page.getHtmlElementById("results");
        int i = 0;
        for(final HtmlTableRow row : resultsT.getRows()){
            Toast.makeText(getApplicationContext(), "Getting Results...", Toast.LENGTH_SHORT).show();
            for(final HtmlTableCell cell : row.getCells()){
                results[i] = cell.asText();
                i++;
            }
        }
    }

发生了什么事?就像我说的,我是 HtmlUnit 的新手,不知道这意味着什么。 我在想是不是Android+WebClient有问题?

我搜索了我的错误并发现了它的含义,但不知道如何修复它。 (WebClient 试图作为一个类运行?)

希望我能尽快弄清楚这一点,谢谢。

-布兰登

This is my first time using HtmlUnit and I am using it within the Android SDK (not sure if thats even possible, if so then stop me now)

So I keep getting an error that seems to be linked to the WebClient:

06-01 22:46:58.939: ERROR/AndroidRuntime(351): Uncaught handler: thread main exiting due to uncaught exception
06-01 22:46:58.969: ERROR/AndroidRuntime(351): java.lang.NoClassDefFoundError: com.gargoylesoftware.htmlunit.DefaultCssErrorHandler
06-01 22:46:58.969: ERROR/AndroidRuntime(351):     at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:154)
06-01 22:46:58.969: ERROR/AndroidRuntime(351):     at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:176)
06-01 22:46:58.969: ERROR/AndroidRuntime(351):     at com.laytproducts.songmaster.mainAct.showResults(mainAct.java:107)
06-01 22:46:58.969: ERROR/AndroidRuntime(351):     at com.laytproducts.songmaster.mainAct$1.onClick(mainAct.java:90)

This is my method it is referring to:

public void showResults(String endText) throws Exception{
        WebClient webClient = new WebClient(); //ERROR ON THIS LINE
        HtmlPage page = webClient.getPage(baseSite+endText);
        HtmlTable resultsT = page.getHtmlElementById("results");
        int i = 0;
        for(final HtmlTableRow row : resultsT.getRows()){
            Toast.makeText(getApplicationContext(), "Getting Results...", Toast.LENGTH_SHORT).show();
            for(final HtmlTableCell cell : row.getCells()){
                results[i] = cell.asText();
                i++;
            }
        }
    }

What is happening? Like I said, I am new to HtmlUnit and have no idea what that means.
I was thinking that there was a problem with Android + WebClient?

I searched my error and found out what it means a little, but not how I can fix it. (The WebClient is trying to run as a class?)

Hopefully I can get this figured out quickly, thanks.

-Brandon

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寂寞清仓 2024-11-18 14:32:31

查看 htmlunit 依赖项(访问他们的网站)。

你缺少一个jar文件

take a look at htmlunit dependencies (go to their website) .

You are missing a jar file

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文