Issue
I have created an app which is working properly on emulator, successfully logged in, api's are working perfectly too. but when i run the app on mobile , my login button is not working.
i have used 8000 port on backend and on api and 127.0.0.1 ip address.
my login api looks like http://127.0.0.1:8000/login
here are the logs when i enter username and password and click on login button .
SocketException: OS Error: Connection refused, errno = 111, address = 127.0.0.1, port = 45304
please help how can i fix it.
Solution
10.0.2.2 is ip address which will work only for your emulator, it's like 127.0.0.1 on computer.
When you want to access localhost from your phone, you have to find your pc's local ip address. You can read how to do it in this article: https://dev.to/tusharsadhwani/connecting-android-apps-to-localhost-simplified-57lm
Answered By - Ady Hnat
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.