React Native APK/AAB (Android) build script 추천

React Native APK/AAB (Android) build script

RN에서 APK/AAB를 생성할 때, 여러 실패 끝에 나름대로 별 탈없이 진행할 수 있는 것은 아래와 같았다.

  • APK 생성 전

- "android/app/src/main/res"에서 이전에 build 과정에서 생성된 파일을 삭제한다.

npx rimraf android/app/src/main/res && git checkout HEAD~1 android/app/src/main/res

* git을 사용하기 때문에, 위와 같은 잔꾀를 부렸다. 단, push되지 않은 파일은 삭제되버리기  때문에, 주의해야 한다.

  • 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

* #2번으로 바로 하게 되면, APK내 이미지가 포함되지 않는 문제를 이르킨다.

  • APK 생성

cd android && ./gradlew assembleDebug --stacktrace

* AAB를 생성하기 위해서는, 아래와 같이 하면 된다.

cd android && ./gradlew bundleDebug --stacktrace

* 굳이, "--stacktrace"를 쓸 필요는 없다.

댓글

이 블로그의 인기 게시물

Webpack copy-webpack-plugin ignore 사용할 때 주의 점(Important point when using the option "ignore" of the "copy-webpack-plugin")

복면가왕 음악을 벅스, 지니 등에서 들으면 드는 생각...

[Windows] Chocolatey upgrade