Wednesday, 10 May 2023

Android emulator not connecting to localhost via 10.0.2.2

My local API setup is running in localhost:3000on my Windows 10. I am using Retrofit to connect with APIs. I used http://10.0.2.2:3000 for connecting Android emulator to Window's localhost. It was working fine for several months. One day it stopped working and I tried so many Google/Stackoverflow posts, but nothing helps. I tried in another newly installed machine and was not working. One day surprisingly it started working without any changes. Now I got my new PC and it is not working. Seems some instability with the 10.0.2.2 trick. Any ideas?

I am getting the below exception

java.net.SocketTimeoutException: failed to connect to /10.0.2.2 (port 3000) from /10.0.2.16 (port 51498) after 60000ms


from Android emulator not connecting to localhost via 10.0.2.2

No comments:

Post a Comment