flutter build commands
- FLUTTER
- 2022. 3. 23.
https://blog.codemagic.io/environments-in-flutter-with-codemagic-cicd/
https://docs.flutter.dev/perf/app-size#reducing-app-size
* Run Debug
By default, flutter run compiles to debug mode.
Dev : flutter run -t lib/main_dev.dart --flavor dev
Stag : flutter run -t lib/main_stag.dart --flavor stag
Prod : flutter run -t lib/main_prod.dart --flavor prod
* Android Build
By default flutter build build for release mode. So you can just do flutter build
By default there isn’t any target-platform then all of android-arm,android-arm64,android-x64
Using --split-debug-info flag can dramatically reduce code size. For an example of using this flag, see Obfuscating Dart code.
flutter build --release
flutter build apk --release
flutter build appbundle --release
flutter build apk -t lib/main_dev.dart --flavor dev --target-platform android-arm,android-arm64,android-x64
flutter build apk -t lib/main_stag.dart --flavor stag --target-platform android-arm,android-arm64,android-x64
flutter build apk -t lib/main_prod.dart --flavor dev --target-platform android-arm,android-arm64,android-x64
APK? APK file (Android Application Package)
These commands will make each apks file for each target platform.
flutter build app bundle builds for 3 platforms: ARM 32-bit, ARM 64-bit, x86 64-bit.
flutter clean
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
App Bundle? AAB file (Android App Bundle)
But we don’t need to make each apk file. We can use aab for real deployment.
https://developer.android.com/guide/app-bundle
https://liapp.lockincomp.com/blog/blog-Post/tech-google-android-app-bundle/
flutter build appbundle --target-platform android-arm,android-arm64,android-x64
--target-platform android-arm,android-arm64,android-x64
* iOS build
flutter build ios -t lib/main_dev.dart --flavor dev
flutter build ios -t lib/main_stag.dart --flavor stag
flutter build ios -t lib/main_prod.dart --flavor prod
Flutter package cache clear
https://stackoverflow.com/questions/55399209/update-flutter-dependencies-in-pub-cache
-t option is for the setting of the entry point of the app.
-t lib/main_dev.dart / -t lib/main_stag.dart / -t lib/main_prod.dart
Options are for the environment values of flutter app.
main_dev.dart will load the .env.dev file.
main_stag.dart will load the .env.stag file.
main_prod.dart will load the .env.prod file.
Each deployment is for each dev, stag, prod. So we may just use each option for each CI/CD.
And it will be the same with –flavor option.
–flavor option and -t main_xxx.dart option are different and independent but logically we should use the same option.
Run with a debug apk binary
'FLUTTER' 카테고리의 다른 글
Flutter ListTile 프로퍼티 정리 참고 (0) | 2022.03.30 |
---|---|
ReorderableListView 드래그앤드랍 리스트 (0) | 2022.03.27 |
flutter release build setting (0) | 2022.03.21 |
flutter dependencies pub cache 에러날 경우 (0) | 2022.03.17 |
android studio flutter cocoapods not installed error message (0) | 2022.02.05 |