개발/react-native

[react-native] 오류 : Unable to load script. Make sure youre dither running a Metro server...

지승준 2019. 7. 18. 17:50

 

react-native 최초 설치 후 안드로이드 스튜디오로 실행할 경우 위와 같은 오류 발생할때

 

1. [패키지명]/android/app/src/main/assets 폴더가 있는지 확인하고 없으면 생성

 

2. [패키지명]/android 폴더에서 ./gradlew clean 실행

 

3. [패키지명] 폴더에서 아래 명령어 실행

 

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

 

4. react-native run-android

 

 

참고

https://dev-yakuza.github.io/ko/react-native/android-running-on-device/
https://medium.com/@adityasingh_32512/solved-unable-to-load-script-from-assets-index-android-bundle-bdc5e3a3d5ff