본문 바로가기
개발/RN

[1/18] 1 .새 프로젝트 생성

by ny0011 2020. 1. 18.
반응형

환경설정이 끝났으니 workspace를 만들어보자

 

react native가 필요한 패키지를 다 설치해주기 때문에 명령어 한줄로 끝

npx react-native init SelfPraise

그럼 SelfPraise라는 폴더가 생기면서 생성 완료~

아래 폴더와 파일들이 생긴다. 굵은 글씨가 폴더.

.
├── App.js
├── __tests__
├── android
├── app.json
├── babel.config.js
├── index.js
├── ios
├── metro.config.js
├── node_modules
├── package.json
└── yarn.lock

 

안드로이드로 실행하려면 아래 명령어 복붙하면 된다

npx react-native run-android

30초 정도 기다리니 에뮬레이터가 실행되고 마이크 접근 권한을 물어본다. 허용 안할걸ㅠ

 

(대충 빌드 실패했다는 뜻 )

~/SelfPraise $ react-native run-android 
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. 
Jetifier found 864 file(s) to forward-jetify. Using 4 workers... 
info Starting JS server... 
* daemon not running; starting now at tcp:5037 
* daemon started successfully info Launching emulator... 
info Successfully launched emulator. 
info Installing the app... 
Downloading https://services.gradle.org/distributions/gradle-5.5-all.zip ................................................................................................................................. 
Welcome to Gradle 5.5! 
Starting a Gradle Daemon (subsequent builds will be faster) 

> Configure project :app
File /.android/repositories.cfg could not be loaded.
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
Warning: License for package Android SDK Platform 28 not accepted.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     build-tools;28.0.3 Android SDK Build-Tools 28.0.3
     platforms;android-28 Android SDK Platform 28
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

BUILD FAILED in 2m 31s

찾아보니 license 창이 떴을 때 yes 안해서 그런가봄...

https://stackoverflow.com/questions/39760172/you-have-not-accepted-the-license-agreements-of-the-following-sdk-components

 

아래 명령어로 모두 yes 해준다

$ yes | ANDROID_HOME/tools/bin/sdkmanager --licenses

 

다시 안드로이드 빌드 하면 실행된다~

 

안녕 리액트

 

'개발 > RN' 카테고리의 다른 글

React Native에 AWS Amplify 설정하기  (0) 2020.02.10
[2/15] react native에 aws amplify를 붙여보자  (0) 2020.01.28
[1/18] 0. 환경 설정  (0) 2020.01.18
[RN-iOS] RN 설치  (0) 2020.01.06

댓글