My test server is iis express, so I can access only localhost:port.
But android emulator's localhost hostname is 10.0.2.2, it occur Bad Request error.
I want change 10.0.2.2 hostname to localhost.
Is it possible? How Can I change it?
My test server is iis express, so I can access only localhost:port.
But android emulator's localhost hostname is 10.0.2.2, it occur Bad Request error.
I want change 10.0.2.2 hostname to localhost.
Is it possible? How Can I change it?
Android emulator runs in a Virtual Machine and using 10.0.2.2
or 127.0.0.1
or localhost
will point to the emulator's own loopback address.
Therefore localhost will not work as a base URL - instead of changing the name you could upgrade to the Url to http://10.0.2.2:8080
.
For more info on this you can have a look at this Medium Post. There is also this question on SO which also addresses the same issue.