I am using Retrofit2 to make network requests but the endpoint is locally on my machine.
So my base URL is private val BASE_URL = "http://localhost:8000/"
, but it gives me this response Failed to connect to localhost/127.0.0.1:5000
So I did some search and I found out that I need to use my local IP address as the following private val BASE_URL = "http:192.168.1.15//:8000/"
, but then I get this response Response{protocol=http/1.1, code=404, message=Not Found, url=http://192.168.1.15//:8000/api/Home/RegisterShop}
Any idea how to solve this issue?
If you are using an Android emulator, the IP address of the host machine would be 10.0.2.2.
So in your case it'd be http://10.0.2.2:8000/
.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments