类文件中泄露的窗口

时间:2014-01-10 17:03:33

标签: android eclipse jsoup memory-leaks

我在Eclipse中遇到了一个问题

  Activity com.soli.RssFeeder.AddNewSiteActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView

有没有人见过这个或知道如何解决这个问题?我已经查看了很多次代码,我根本不明白可以做些什么来解决它。

logcat的:

      '
      01-10 22:10:19.311: E/AndroidRuntime(9045): FATAL EXCEPTION: AsyncTask #4
  01-10 22:10:19.311: E/AndroidRuntime(9045): java.lang.RuntimeException: An error         occured while executing doInBackground()
  01-10 22:10:19.311: E/AndroidRuntime(9045):   at android.os.AsyncTask$3.done(AsyncTask.java)
   01-10 22:10:19.311: E/AndroidRuntime(9045):  at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java)
   01-10 22:10:19.311: E/AndroidRuntime(9045):  at java.util.concurrent.FutureTask.setException(FutureTask.java)
   01-10 22:10:19.311: E/AndroidRuntime(9045):  at java.util.concurrent.FutureTask.run(FutureTask.java)
   01-10 22:10:19.311: E/AndroidRuntime(9045):  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java)
   01-10 22:10:19.311: E/AndroidRuntime(9045):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java)
   01-10 22:10:19.311: E/AndroidRuntime(9045):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java)
   01-10 22:10:19.311: E/AndroidRuntime(9045):  at java.lang.Thread.run(Thread.java)
    01-10 22:10:19.311: E/AndroidRuntime(9045): Caused by: java.lang.IllegalStateException: Target host must not be null, or set in parameters. scheme=null, host=null, path=/rss/topNews
    01-10 22:10:19.311: E/AndroidRuntime(9045):     at org.apache.http.impl.client.DefaultRequestDirector.determineRoute(DefaultRequestDirector.java)
     01-10 22:10:19.311: E/AndroidRuntime(9045):    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java)
     01-10 22:10:19.311: E/AndroidRuntime(9045):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java)
     01-10 22:10:19.311: E/AndroidRuntime(9045):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java)
      01-10 22:10:19.311: E/AndroidRuntime(9045):   at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java)
     01-10 22:10:19.311: E/AndroidRuntime(9045):    at com.soli.RssFeeder.RSSParser.getXmlFromUrl(RSSParser.java:198)
     01-10 22:10:19.311: E/AndroidRuntime(9045):    at com.soli.RssFeeder.RSSParser.getRSSFeed(RSSParser.java:64)
     01-10 22:10:19.311: E/AndroidRuntime(9045):    at com.soli.RssFeeder.AddNewSiteActivity$loadRSSFeed.doInBackground(AddNewSiteActivity.java:98)
     01-10 22:10:19.311: E/AndroidRuntime(9045):    at com.soli.RssFeeder.AddNewSiteActivity$loadRSSFeed.doInBackground(AddNewSiteActivity.java:1)
      01-10 22:10:19.311: E/AndroidRuntime(9045):   at android.os.AsyncTask$2.call(AsyncTask.java)
      01-10 22:10:19.311: E/AndroidRuntime(9045):   ... 5 more
      01-10 22:10:19.956: E/WindowManager(9045): Activity com.soli.RssFeeder.AddNewSiteActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{41f4ff98 V.E..... R......D 0,0-       684,192} that was originally added here
      01-10 22:10:19.956: E/WindowManager(9045): android.view.WindowLeaked: Activity com.soli.RssFeeder.AddNewSiteActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{41f4ff98 V.E..... R......D 0,0-684,192} that was originally added here
     01-10 22:10:19.956: E/WindowManager(9045):     at android.view.ViewRootImpl.<init>(ViewRootImpl.java)
       01-10 22:10:19.956: E/WindowManager(9045):   at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java)
     01-10 22:10:19.956: E/WindowManager(9045):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java)
       01-10 22:10:19.956: E/WindowManager(9045):   at android.app.Dialog.show(Dialog.java)
    01-10 22:10:19.956: E/WindowManager(9045):  at com.soli.RssFeeder.AddNewSiteActivity$loadRSSFeed.onPreExecute(AddNewSiteActivity.java:89)
     01-10 22:10:19.956: E/WindowManager(9045):     at android.os.AsyncTask.executeOnExecutor(AsyncTask.java)
     01-10 22:10:19.956: E/WindowManager(9045):     at android.os.AsyncTask.execute(AsyncTask.java)
    01-10 22:10:19.956: E/WindowManager(9045):  at com.soli.RssFeeder.AddNewSiteActivity$1.onClick(AddNewSiteActivity.java:53)
     01-10 22:10:19.956: E/WindowManager(9045):     at android.view.View.performClick(View.java)
     01-10 22:10:19.956: E/WindowManager(9045):     at android.view.View$PerformClick.run(View.java)
     01-10 22:10:19.956: E/WindowManager(9045):     at android.os.Handler.handleCallback(Handler.java)
      01-10 22:10:19.956: E/WindowManager(9045):    at android.os.Handler.dispatchMessage(Handler.java)
       01-10 22:10:19.956: E/WindowManager(9045):   at android.os.Looper.loop(Looper.java)
      01-10 22:10:19.956: E/WindowManager(9045):    at android.app.ActivityThread.main(ActivityThread.java)
      01-10 22:10:19.956: E/WindowManager(9045):    at java.lang.reflect.Method.invokeNative(Native Method)
      01-10 22:10:19.956: E/WindowManager(9045):    at java.lang.reflect.Method.invoke(Method.java)
      01-10 22:10:19.956: E/WindowManager(9045):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
       01-10 22:10:19.956: E/WindowManager(9045):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
       01-10 22:10:19.956: E/WindowManager(9045):   at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:112)
       01-10 22:10:19.956: E/WindowManager(9045):   at dalvik.system.NativeStart.main(Native Method)

      '

1 个答案:

答案 0 :(得分:0)

检查这些行中的内容

 01-10 22:10:19.311: E/AndroidRuntime(9045):    at com.soli.RssFeeder.RSSParser.getXmlFromUrl(RSSParser.java:198)
     01-10 22:10:19.311: E/AndroidRuntime(9045):    at com.soli.RssFeeder.RSSParser.getRSSFeed(RSSParser.java:64)
     01-10 22:10:19.311: E/AndroidRuntime(9045):    at com.soli.RssFeeder.AddNewSiteActivity$loadRSSFeed.doInBackground(AddNewSiteActivity.java:98)
     01-10 22:10:19.311: E/AndroidRuntime(9045):    at com.soli.RssFeeder.AddNewSiteActivity$loadRSSFeed.doInBackground(AddNewSiteActivity.java:1)

错误可能如下。检查这些代码区域

RSSParser.java - 第198行,第64行和方法getRSSFeed和getXmlFromUrl AddNewSiteActivity - 第98行和方法doInBackground