简体   繁体   中英

Unable to connect to Node JS localhost API from android app in emulator

I run Node JS on localhost. Trying to call one of the Node API http://10.0.2.2:8000/api_users from android app running in the emulator. FileNotFound exception or FailedToConnect exception is what I end up with.

Am I doing anything wrong? Is there another way to connect to the NodeJS API running locally?

Kindly help. Thanks in Advance.

Right now, your API isn't working, because Android EMULATES a phone, having their own local, on the phone, but not linked at all from your phone to your computer, that's why there is no access to your API via localhost. Right now, the emulator tries to access the localhost from the phone. You can solve that by using a local IP Adress

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM