|
| 1 | +--- |
| 2 | +sidebar_position: 1 |
| 3 | +--- |
| 4 | + |
| 5 | +# APK File Format |
| 6 | +This command is used to build the project in the form of an `.apk` file. |
| 7 | + |
| 8 | +## Default |
| 9 | +By default this command will build the project with the release version staging flavor. |
| 10 | +```bash |
| 11 | +gits build apk |
| 12 | +``` |
| 13 | +After the building process is complete, we can check the `.apk` file in the `build/app/outputs/apk/` and `build/app/outputs/flutter-apk/` folders. |
| 14 | + |
| 15 | +## Options : |
| 16 | + |
| 17 | +```bash |
| 18 | +gits build apk [flavor/environment] [app_version] [custom_target] [build_number] [build_name] [[no-]obfuscate] [split-debug-info] |
| 19 | +``` |
| 20 | +- Flavor/Environment : |
| 21 | + |
| 22 | +| Flavor/Environment | Alternative | Description | |
| 23 | +|----------|-------------|-------------| |
| 24 | +| `-f dev` | `--flavor dev` | Build project on dev environment (Default) | |
| 25 | +| `-f stag` | `--flavor stag` | Build project on staging environment| |
| 26 | +| `-f prod` | `--flavor prod` | Build project on production environment | |
| 27 | + |
| 28 | +- App Version : |
| 29 | + |
| 30 | +| App Version | Description | |
| 31 | +|----------|-------------| |
| 32 | +| `--debug` | Build project on debug mode (Default) | |
| 33 | +| `--profile` | Build project on profile mode| |
| 34 | +| `--release` | Build project on release mode (Default) | |
| 35 | + |
| 36 | +- Custom Target : |
| 37 | + |
| 38 | +| Custom Target | Alternative | Description | |
| 39 | +|----------|-------------|-------------| |
| 40 | +| `-t [url_file]` | `--target [url_file]` | This command is used to build the application in a specific file, by default it will run the `lib/main.dart` file. | |
| 41 | + |
| 42 | +- Custom Build Name : |
| 43 | + |
| 44 | +| Build Name | Description | |
| 45 | +|----------|-------------| |
| 46 | +| `--build-name [build_number]` | This command is used to build application with a specific name.| |
| 47 | + |
| 48 | +- Custom Build Number : |
| 49 | + |
| 50 | +| Build Number | Description | |
| 51 | +|----------|-------------| |
| 52 | +| `--build-number [build_number]` | This command is used to build application with a specific version number.| |
| 53 | + |
| 54 | +- No Obfuscate : |
| 55 | + |
| 56 | +| Build Number | Description | |
| 57 | +|----------|-------------| |
| 58 | +| `--[no-]obfuscate` | In a release build, this flag removes identifiers and replaces them with randomized values for the purposes of source code obfuscation. This flag must always be combined with "--split-debug-info" option, the mapping between the values and the original identifiers is stored in the symbol map created in the specified directory. For an app built with this flag, the "flutter symbolize" command with the right program symbol file is required to obtain a human readable stack trace. (defaults to on)| |
| 59 | + |
| 60 | +- Split Debug Info : |
| 61 | + |
| 62 | +| Build Number | Description | |
| 63 | +|----------|-------------| |
| 64 | +| `--split-debug-info` | In a release build, this flag reduces application size by storing Dart program symbols in a separate file on the host rather than in the application. The value of the flag should be a directory where program symbol files can be stored for later use. These symbol files contain the information needed to symbolize Dart stack traces. For an app built with this flag, the "flutter symbolize" command with the right program symbol file is required to obtain a human readable stack trace. This flag cannot be combined with "--analyze-size". (defaults to "./.symbols/") | |
| 65 | + |
| 66 | +## Example - Custom Version |
| 67 | +1. Debug Version |
| 68 | + ```bash |
| 69 | + gits build apk --debug |
| 70 | + ``` |
| 71 | + |
| 72 | +2. Profile Version |
| 73 | + ```bash |
| 74 | + gits build apk --profile |
| 75 | + ``` |
| 76 | + |
| 77 | +3. Release Version |
| 78 | + ```bash |
| 79 | + gits build apk --release |
| 80 | + ``` |
| 81 | + |
| 82 | +## Example - Custom Environment/Flavor |
| 83 | + |
| 84 | +1. Dev Environment |
| 85 | + ```bash |
| 86 | + gits build apk -f dev |
| 87 | + ``` |
| 88 | + Alternative: |
| 89 | + ```bash |
| 90 | + gits build apk --flavor dev |
| 91 | + ``` |
| 92 | +2. Staging Environment |
| 93 | + ```bash |
| 94 | + gits build apk -f dev |
| 95 | + ``` |
| 96 | + Alternative: |
| 97 | + ```bash |
| 98 | + gits build apk --flavor dev |
| 99 | + ``` |
| 100 | +3. Production Environment |
| 101 | + ```bash |
| 102 | + gits build apk -f dev |
| 103 | + ``` |
| 104 | + Alternative: |
| 105 | + ```bash |
| 106 | + gits build apk --flavor dev |
| 107 | + ``` |
| 108 | + |
| 109 | +## Example - Custom Version and Environment Combination |
| 110 | +```bash |
| 111 | +gits build apk --release -f prod |
| 112 | +``` |
| 113 | + |
| 114 | +## Example - Custom Target |
| 115 | +```bash |
| 116 | +gits build apk --target [url_file *optional] |
| 117 | +``` |
| 118 | +Alternative: |
| 119 | +```bash |
| 120 | +gits build apk --t [url_file *optional] |
| 121 | +``` |
| 122 | + |
| 123 | +## Example - Custom gits.yaml |
| 124 | +```bash |
| 125 | +gits build apk --gits-yaml [custom_path] |
| 126 | +``` |
| 127 | +## Example - Custom Build Number |
| 128 | +```bash |
| 129 | +gits build apk --build-number [build_number] |
| 130 | +``` |
| 131 | +For example, we create an apk file with the custom build number `1.0.0` |
| 132 | +```bash |
| 133 | +gits build apk --build-number 1.0.0 |
| 134 | +``` |
| 135 | + |
| 136 | +## Example - Custom Build Name |
| 137 | +```bash |
| 138 | +gits build apk --build-name [build_name] |
| 139 | +``` |
| 140 | +For example, we create an apk file with the name `application_release` |
| 141 | +```bash |
| 142 | +gits build apk --build-name application_release |
| 143 | +``` |
| 144 | + |
| 145 | +## Example - No Obfuscate |
| 146 | +```bash |
| 147 | +gits build apk --[no-]obfuscate |
| 148 | +``` |
| 149 | + |
| 150 | +## Example - Split Debug Info |
| 151 | +```bash |
| 152 | +gits build apk --split-debug-info |
| 153 | +``` |
0 commit comments