Android java.net.UnknownHostException: Host is unresolved

前端 未结 17 1062
被撕碎了的回忆
被撕碎了的回忆 2020-12-01 08:43

This code doesn\'t work:

URL         url   = new URL( xmlPath );
InputSource input = new InputSource( url.openStream() );

all the time, res

17条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-01 09:33

    Thank you so much Russ. I'm glad you persisted. I had spent the best part of an hour reading all kinds of possible fixes to this error. Just for anyone else stumbling across this thread, i'll briefly recap here: -Check Internet uses permission is in the manifest -Catching the exception (pointless) -Changing firewall settings on your OS -Share connection (windows only) And a load of other stuff

    My fix took a little more than yours, but not much. After reading your post, I closed and destroyed all emulators. Then I noticed that when I moused over the run button (green circle with white arrow) it said the program was already running, even though no AVDs (emulators) existed! Anyway, restarted eclipse, created a AVD and ran it and Bob was my father's brother. Nothing to do with my code or setup at all.

    I found this afterwards. It may well achieve the same thing but I can't vouch for it unless the problem reoccurs. http://www.jiahaoliuliu.com/2011/02/stopping-android-applications-already.html Another trick that /may/ achieve the same result is tick "wipe user data" in Run Configurations, Target tab.

提交回复
热议问题