I have setup a local server running on 127.0.0.1/3000 on my MacBook. My Android app sends requests to 10.0.2.2/3000 to make connection with the server. This works pretty well until I configured the APN in the Android emulator settings. In the APN settings, I set the Proxy to be 192.168.x.xxx and the port number to be 8001. With these settings, the local server is not able to accept any messages sent from my app now. Closing the APN proxy is not an option because my app also needs to connect to some remote services. So how to connect to the local server with APN proxy on?
Asked
Active
Viewed 274 times
0
-
`I have setup a local server running on 127.0.0.1/3000 on my MacBook.` It is running on your MacBook and if you bound it to 127.0.0.1 your server is not accessable from other devices. – blackapps Mar 13 '21 at 08:10
-
Local server? To a server on the same macbook as the emulator is running on i think. – blackapps Mar 13 '21 at 08:11
-
`the local server is not able to accept any messages sent from my app now.` I think your app can not connect to the server running on the same macbook. And no connection no messages. – blackapps Mar 13 '21 at 08:14
-
What is the local lan ip of the book? Did you try it? And what is APN? – blackapps Mar 13 '21 at 08:17
1 Answers
0
I find the answer. Instead of listening on 127.0.0.1/3000, I configured my local server to listen on 0.0.0.0/3000. Instead of making request to 10.0.2.2/3000 in my Android app, I now make request to 192.168.x.xxx/3000. The local server now can accept messages sent from my Android app.

Richard Hu
- 811
- 5
- 18
-
1Found? That is what i said: do not bind to an ip address and use local lan ip of your macbook. Glad you followed advice. – blackapps Mar 13 '21 at 08:35