开发者

Apache Httpget with https url - Host is unresolved error

开发者 https://www.devze.com 2022-12-30 11:12 出处:网络
Using HttpGet httpget = new HttpGet(urlToGet); I get an intermittent error t开发者_Go百科hat results in a forced closure of the app. The error is always Host is unresolved: www..com:443

Using

HttpGet httpget = new HttpGet(urlToGet);

I get an intermittent error t开发者_Go百科hat results in a forced closure of the app. The error is always Host is unresolved: www..com:443

How can I stop this from happening?


Elsewhere, I answered a closely related question to this one: remove your AVD (emulator), then re-create it. (Also, make sure you've got that magic Internet permission statement in your manifest file, but I assume that's not your problem.) I don't know if this will do it for you, but it worked like a charm for me. Apparently, this is a fly in Android's ointment.


If all normal solutions fail (permissions are ok, encoding is ok, url is working on your computer), you might have to edit your Android's hostfile. Suppose the url works in your pc's/mac browser, but not on your android phone, check the host files on your computer (windows/system32/drivers/etc/ or private/etc/) and see if you're url is re-directed in the host file.

If so, you must add it to your Android's phone hostfile as well. http://forum.xda-developers.com/showthread.php?t=514698

Also see http://en.wikipedia.org/wiki/Hosts_(file) for more info... I 've had this once when a webservice was still in testing mode

0

精彩评论

暂无评论...
验证码 换一张
取 消