1. yarn run android로 잘 되는 지 확인
2. 패키지 및 라이브러리 에러 시, 인터넷 검색해서 각 패키지 하위의 android 에서 build.gradle을 수정함. 버전 다운그레이드 필요.
Ex)
dependencies {
implementation 'com.facebook.react:react-native:+'
implementation 'com.google.android.gms:play-services-ads:19.6.0' // '+' > 19.6.0 수정
}
3. 아예 패키지 버전 변경이 필요할 경우, yarn upgrade react-native-push-notification@^7.3.0 --save
4. 아래 andoid > build.gradle을 아래와 같이 수정
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
googlePlayServicesVersion = "+" // default: "+"
firebaseMessagingVersion = "21.1.0" // default: "+"
buildToolsVersion = "30.0.2"
minSdkVersion = 16
compileSdkVersion = 30
targetSdkVersion = 30
supportLibVersion = "30.0.0"
googlePlayServicesAuthVersion = "16.0.1"
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath('com.android.tools.build:gradle:3.6.4')
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:perf-plugin:1.3.1'
classpath 'io.fabric.tools:gradle:1.31.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
}
}
5. 안드로이드 에뮬레이터 실행이 안되어 있다고 뜰 경우, 안드로이드 에뮬레이터를 먼저 실행 후에 yarn run android 실행
안드로이드 스튜디오 > Configure > AVD Manager > 하나 선택 후 실행
6. (테스트) 실제 기기 테스트
- USB-C to USB-C 연결
- 디버깅 항상 허용에 체크
- 설정 > 개발자 옵션 > USB 디버깅 체크 허용
- yarn run android
7. 아래 명령어 (배포 빌드)
// 사용자 설치용
cd android
./gradlew assembleRelease
//앱스토어 배포용
cd android
./gradlew bundleRelease
(만약 gradlew 명령어를 zsh에서 인식 못할 경우 아래)
chmod 777 gradlew // then 아래
=> ./gradlew bundleRelease
7+. 빌드 버전 올리기/수정/업데이트
android > app > build.gradle에서 아래를 수정
versionCode 225
versionName "2.2.5"
저장
8. 4분 정도 소요
9. 키스토어가 없다고 뜨는 경우, 팀원에게 키스토어를 받아서, Android > App 하위에 두면 됨
10. 빌드 성공
11. /Users/jaehoonlim/Desktop/live/dyedye-reactnative/android/app/build/outputs/bundle/release 에 보면 빌드 완료된 파일이 있음.
12. Play Console 들어가기 > 프로덕션 > 버전 수정 > App bundle에 위 폴더의 빌드 완료된 .aab 파일을 업로드. > 버전 정보 등 수정 > 저장 > 버전 검토 > 프로덕션 트랙으로 출시 시작