generated from osamhack2020/Sample_Technology_ProjectName_TeamName
-
Notifications
You must be signed in to change notification settings - Fork 2
how to setting environment and build files
Kanghee.J edited this page Oct 30, 2020
·
2 revisions
-
터미널 열기
-
React Native 프로젝트 생성
npm install -g react-native-cli
cd ..
react-native init workspace
- Android SDK 설치
cd ~
wget https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip
unzip commandlinetools-linux-6609375_latest.zip
rm commandlinetools-linux-6609375_latest.zip
mkdir android-sdk
mv tools android-sdk/tools
- PATH 설정 (.bachrc에 추가)
export ANDROID_HOME=$HOME/android-sdk
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
- PATH 설정 후
source .bashrc
- SDK 설치
project_root/android/build.gradle 을 통해 Android 버전 확인
확인 후 아래 명령어를 통해 Android 28버전 설치
sdkmanager --sdk_root=${ANDROID_HOME} "platform-tools" "platforms;android-28"
- apk 빌드 및 생성
mkdir android/app/src/main/assets
- package.json 수정 ( “scripts” 부분에 추가)
"scripts": { "bundle": "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" }
cd workspace
npm run bundle
cd android
./gradlew assembleDebug
- 생성 위치 : workspace/android/app/build/outputs/apk/debug/
- Git 저장소에 업로드
- APK 파일을 저장소에 업로드(프로젝트가 GitHub에 업로드 되어 있을 경우) git add workspace/android/app/build/outputs/apk/debug/apk_name.apk
- Commit & Push