【问题标题】:jSoup.connect(url).get() gives an error Exception Android ApplicationjSoup.connect(url).get() 给出错误异常 Android 应用程序
【发布时间】:2014-05-26 12:40:39
【问题描述】:

jSoup.connect(url).get() 在我的 Android 应用程序中给出错误异常。 URL 在浏览器上工作正常或使用“HTTPCLIENT”点击 URL,但是当我通过 jsoup 访问它时,它会在 android 中引发异常。

public class PracticeDetailsRequest extends AsyncTask<String, String, ArrayList<JSONObject>>{

public LoginActivity activity;
PracticeDetailsRequest(LoginActivity context)
{
    activity = context;
} 

@Override
protected ArrayList<JSONObject> doInBackground(String... value) {

    string url= "http://cmdlhravn01/ChargeCapture/Authentication/ChargeCaptureLogin?username=bilbl786&password=2ac9da7dc0243c0083eb70898e549b63&practiceid=1&userid=78&locationid=2&DBName=MUII_CureMD&DBServerName=cmdlhrnavqa01";
    jSoup.connect(url).get();
}
}

例外:

    05-26 17:31:05.589: E/ActivityThread(22045): Activity com.example.avalon.LoginActivity has leaked IntentReceiver org.apache.cordova.CordovaWebView$1@41e6bdd0 that was originally registered here. Are you missing a call to unregisterReceiver()?
    05-26 17:31:05.589: E/ActivityThread(22045): android.app.IntentReceiverLeaked: Activity com.example.avalon.LoginActivity has leaked IntentReceiver org.apache.cordova.CordovaWebView$1@41e6bdd0 that was originally registered here. Are you missing a call to unregisterReceiver()?
    05-26 17:31:05.589: E/ActivityThread(22045):    at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:805)

【问题讨论】:

  • 实际上你应该尝试什么?
  • @AmitPrajapati 我的字符串对象中需要 html 源代码。您可以在浏览器中点击 url 并检查它在浏览器上是否正常工作,但在代码上它会给出错误
  • 对我来说工作正常可能是我公司的服务器代理...

标签: java android multithreading cordova jsoup


【解决方案1】:

您需要在onPause() 方法中使用unregisterReceiver()。然后你可以在onRestart()方法中重新注册。

更多信息在这里: Android: Leaked IntentReceiver exception is being thrown even though I call unregisterReceiver

【讨论】:

  • 它与 HttpClient.Execute 配合得很好,但它只会给我 Jsoup.connect 上的错误
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-11-14
  • 1970-01-01
  • 2012-12-17
  • 1970-01-01
相关资源
最近更新 更多