Android java.net.UnknownHostException: Host is unresolved

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

    In my case I was downloading an XML file from a URL on my phone but was having the issue describe in this thread.

    for fixing it, I not only needed to have the regular internet permission

     
    

    But I also needed

    
    

    As a suggestion to see if your device may need the same thing, try navigating to the URL in your phone's browser to see if prompts about needing SD Card or something.

    Hope that helps others.

提交回复
热议问题