프로그래밍/React Native

react native 안드로이드 emulator api 연동시 localhost 이슈

p-a-r-k 2020. 4. 2. 13:25
반응형

android 개발시에 백엔드 api를 통해서 localhost의 9090포트로 호출시 response를 못받는 상황이 발생.

axios의 문제인가해서 http://다른 url을 통해서 해봤더니 잘 받아온다..

adb reverse 커맨드를 통해 설정을 해줘야 하는듯하다.

 

https://stackoverflow.com/questions/33704130/react-native-android-fetch-failing-on-connection-to-local-api

 

React Native Android Fetch failing on connection to local API

I'm using the fetch API in my react-native Android app to make requests to a local API. I usually query said API from react web apps at http://localhost:8163. I'm testing my app on my physical de...

stackoverflow.com

emulemulator 띄워두고 터미널에서 아래 명령을 실행한다.

adb reverse tcp:<PORT> tcp:<PORT>
반응형