리액트 네이티브 초기세팅 & 시뮬레이터 에러 해결

Jivyy·2021년 1월 6일
1

새로운 리액트 네이티브 프로젝트 생성

react-native init --version (원하는 버전정보) 프로젝트명

구동하기(ios)

프로젝트 경로에서 npm start 를 해준 후 새 터미널을 추가해 react-native run-ios

구동하기(android)

프로젝트 경로에서 npm start 해준 후 android studio 를 실행 =>configure/AVD manager=>원하는 android 기기의 action 버튼을 눌러 시뮬레이터 실행=>vs code로 돌아와 새 터미널을 추가해 react-native run-android

안드로이드 시뮬레이터 에러 발생

나의 경우 ios 구동은 잘 되었으나 안드로이드 시뮬레이터를 구동할 때마다 아래와 같이 빌드에 실패했다는 에러메세지가 발생했다.
SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '~/android/local.properties'.

해결방법

해당 프로젝트 내의 android 디렉토리에 local.properties 라는 파일을 생성해 주고, 생성한 파일에 sdk.dir = /Users/USERNAME/Library/Android/sdk 라고 작성해준 후 다시 시뮬레이터를 구동하니 해결되었다.

profile
나만의 속도로

2개의 댓글

comment-user-thumbnail
2021년 1월 6일

아주 열심이시네요~

1개의 답글