Android java.net.UnknownHostException: Host is unresolved

前端 未结 17 1052
被撕碎了的回忆
被撕碎了的回忆 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:27

    I couldn't get rid of the emulator "UnknownHostExceptions" - and the emulator's browser wouldn't get a connection either. Tried all suggestions I could find at stack overflow and everywhere else.

    Finally I deleted my AVD, shut down Eclipse, and then created the AVD via the command line. Then launched it via command line with the -dns-server 8.8.8.8. (on my Mac: ./emulator -avd Google-8 -dns-server 8.8.8.8) It finally worked!

    Hope this helps someone else.

提交回复
热议问题