3

I am trying to access a virtual machine url in browser of android emulator to build an application. But I keep getting this error

The webpage at 
https://virtualmachinehost.name.com:1443/myserviceurl 

net:ERR_NAME_NOT_RESOLVED

I did some google search also. I can access any other website on this browser. I also tried to add the ip address of this virutal machine with its hostname in hosts file. But nothing has helped.

Network Setup: Host machine IP - 10.X.X.130 VM IP - 172.X.X.238 emulator client IP - 192.X.X.102

4
  • Try pinging the domain using shell or an app from the emulator and post the results here
    – Ihab
    Oct 9, 2017 at 13:34
  • If I ping domain name, I get unknown host. But if I ping ip addess of that VM, it is correctly pinging that VM.
    – yogsma
    Oct 9, 2017 at 13:48
  • Would you please give me more details regarding your setup ? What is the IP of the VM and what is the ip of the emulator client, also what is the host machines IP ?
    – Ihab
    Oct 9, 2017 at 13:58
  • Host machine ip - 10.X.X.130, VM ip - 172.X.X.238, emulator client IP - 192.X.X.102
    – yogsma
    Oct 9, 2017 at 14:03

4 Answers 4

3

Restarting the computer solved this for me.

2
+25

"If I ping domain name, I get unknown host. But if I ping ip addess of that VM, it is correctly pinging that VM"

This indicates that the /etc/hosts modification you made is not working. If it was working correctly then the domain name would map to the ip address and you would be fine. I noticed that you are using a hierarchical domain name (IE: top level domain is com, subdomain is virtualmachinehost, and hostname is name). This has to be in the hosts file also in order to work, but there may be an easier solution.

May recomend that you simplify your hosts file and url by doing the following:

  1. In the host file change the entry to: machinename <IP address>. do not add a domain or subdomain
  2. Changed your referenced URL to: https://machinename:1443/myserviceurl
2
  • I tried this, but I don't get the error. But it also doesn't access the serviceurl, it just shows me white screen
    – yogsma
    Oct 18, 2017 at 19:40
  • can you now ping the machine with ping machinename? If you can then you probably need to put a firewall rule in to allow HTTPS traffic on port 1443
    – Liam Kelly
    Oct 18, 2017 at 20:33
2

Restarting the emulator resolved this issue for me.

1

Your problem is that there is no direct route from your emulator to your virtual machine through your host machine. You need to setup a routing table on the host machine to translate the addresses.

A quick and simple solution would be to have both the emulator and VM be NAT-ed with the host machine.

More info on NATing: https://www.vmware.com/support/ws55/doc/ws_net_configurations_nat.html

1
  • What you are giving with that link is the regular NAT, but not about android emulator? Not sure what has changed in recent Android emulator APIs that we have to do these extra steps. Previously with hosts file it used to work.
    – yogsma
    Oct 9, 2017 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.