반응형
리액트 네이티브로 개발하면서 발생하는 오류중에 오류 해결이 오래 걸릴때가 있는데 이번 오류가 그랬다.
해결방안을 많이 검색해서 수정해봤지만 해결되지는 않았고, 한참후에야 해결할 수 있었다.
현상
- 앱이 실행은 되지만 소스를 수정해도 적용되지 않는다.
수정
- 메트로 서버를 기동할때 npm start 명령어로 기동했는데, 아래 명령어로 실행했더니 변화가 있었다.
// 메트로 서버 기동
npx react-native start --reset-cache
// 안드로이드 시뮬레이터 기동
npx react-native run-android
npx로 기동했더니 아래와 같이 다른 오류가 발생했다.
위 오류는 Android > app > src > main > res > xml > network_security_config.xml 파일을 수정하여 해결했다.
오류메시지의 IP를 network_security_config.xml 파일의 includeSubdomains="true"로 설정하여 추가해준다.
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">localhost</domain>
<domain includeSubdomains="true">127.0.0.0</domain>
<domain includeSubdomains="true">10.0.0.0</domain>
<domain includeSubdomains="true">172.16.0.0</domain>
<domain includeSubdomains="true">192.168.0.0</domain>
<!-- 이곳에 오류메시지의 ip를 추가해준다. -->
</domain-config>
</network-security-config>
반응형
'Frontend > React Native' 카테고리의 다른 글
[React Native] 리액트 네이티브 데이터 처리 시 splash loading 로딩 구현하기 (0) | 2023.06.02 |
---|---|
[React Native] 리액트 네이티브 address already in use 각종 오류 수정 fix 정리 - 트러블 슈팅 (0) | 2023.04.28 |
[React Native] 리액트 네이티브 안드로이드 기기에 빌드하기 - apk 만들기 (0) | 2023.04.04 |
[React Native] 리액트 네이티브 각종 clean 및 캐시 삭제와 라이브러리 설치 (0) | 2023.04.03 |
[React Native] 리액트 네이비브 디버깅 하는법, 키보드 가릴때, 상태값 변경에 대해 (0) | 2023.03.31 |
댓글