Reputation: 25
I experience a problem in my android app and wonder if you know a solution.
I use HttpUrlConnection and if i connect to the host myhost.local
(via http and https both is possible) everything works just fine. But if I want to connect to the host myhost
I get following exception:
java.net.UnknownHostException: Unable to resolve host
insert_host_here
: No address associated with hostname
If I use the browser on my phone both myhost.local
and my myhost
can be accessed.
And if I type $ host myhost
into terminal i get following answer
user@machine:$ host myhost.local
myhost.local has address 192.168.0.115
user@machine:$ host myhost
myhost.local has address 192.168.0.115
There is no proxy in between or something. Its the direct answer from the dns. Some idea what it could be?
Greetz
btw: internet permission is granted / device has access to wifi / Version on tested device is Android 4.3 / Emulator shows same result
Upvotes: 0
Views: 888
Reputation: 123
Have you tried using 10.0.2.2 instead of localhost? I had a similar problem even though I was not even using an emulator. Accessing Localhost from the Android Emulator
Upvotes: 1