HtmlUnit Android 错误
这是我第一次使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 htmlunit 依赖项(访问他们的网站)。
你缺少一个jar文件
take a look at htmlunit dependencies (go to their website) .
You are missing a jar file