반응형
현상:
1. 로컬에서 docker 로 웹서버 띄운 후 에뮬레이터로 접속 시 안됨
2. 브라우저로 접속 시엔 됨

원인:
1. 안드로이드 에뮬레이터의 localhost와 pc의 localhost가 정상적으로 연결 돼 있지 않음
2. stackoverflow에서 안드로이드 localhost가 별도로 정해져 있는 것을 알게 됨 (10.0.2.2 로 연결해야 됨)
https://stackoverflow.com/questions/5528850/how-do-you-connect-localhost-in-the-android-emulator
How do you connect localhost in the Android emulator?
I have made a php script inside localhost and I am connecting that with httpClient but I am getting a problem. Please tell me how can I connect to a php file at localhost from the emulator?
stackoverflow.com
3. 그 전엔 왜 localhost로 바로 맵핑이 됐는지 모르겠음
반응형
'콤퓨타 > 안드로이드' 카테고리의 다른 글
| Remember와 State에 대한 이해 (MutableState, etc) (0) | 2024.08.01 |
|---|---|
| android build설정에 대해 알아보기 (0) | 2024.03.09 |
| News API 를 활용한 뉴스 어플리케이션 프로젝트 (3) Splash screen 적용하기 (1) | 2024.02.11 |
| 안드로이드 개념 참고 창 (1) | 2024.02.01 |
| News API 를 활용한 뉴스 어플리케이션 프로젝트 (2)_Retrofit 적용하기 (0) | 2024.01.31 |