Flutter Post-Build Organizer
A powerful and configurable command-line tool to automatically rename and organize your Flutter build artifacts (APKs and AABs) after the build process is complete.
About
The flutter build command produces predictably named files (e.g., app-release.apk, app-release.aab). This tool runs after the build to:
- Rename artifacts using your own naming convention
- Append version information automatically
- Organize outputs into a clean directory
All without touching Gradle or writing custom scripts.
Features
-
Rename APKs & AABs
- APKs and App Bundles are automatically renamed using your package name and build metadata.
-
Versioned Output
-
Automatically appends version from
pubspec.yamlmy_app_1.2.2_a64.apk
-
-
Architecture-Aware Naming
armeabi-v7a→v7aarm64-v8a→a64x86_64→x86- universal APK →
uni - app bundle →
bundle
-
Selective Artifact Filtering
- Skip specific APK variants using
discardrules.
- Skip specific APK variants using
-
Organized Output Directory
- Move or copy artifacts into a clean folder like
./release.
- Move or copy artifacts into a clean folder like
-
Copy or Move
- Preserve original build artifacts if needed.
-
Automatic Cleanup
- Optionally delete the
build/folder after processing.
- Optionally delete the
-
Safe File Handling
- Cross-device safe operations (fallback copy + delete)
- Prevents overwriting existing files
-
Simple Configuration
- Everything configured via
pubspec.yaml
- Everything configured via
Installation
You can install the tool globally (recommended) or as a development dependency.
Option A: Global Activation (Recommended)
dart pub global activate flutter_post_build
Option B: Dev Dependency
flutter pub add --dev flutter_post_build
Configuration
Add this block to your project's pubspec.yaml:
flutter_post_builder:
# (Required) Base name for generated artifacts
package_name: "my_app"
# (Optional) Append version from pubspec.yaml (default: true)
append_version: true
# (Optional) Output directory
final_directory: "./release"
# (Optional) Move or copy files (default: true)
move_files: true
# (Optional) Skip specific APK variants
discard:
v7a: false
a64: false
x86: false
uni: false
# (Optional) Delete build folder after processing
clean_build_folder: true
Usage
1. Build your Flutter app
Split APKs (recommended)
flutter build apk --split-per-abi
Universal APK
flutter build apk
App Bundle
flutter build appbundle
2. Run the Post-Build Tool
If installed globally:
flutter_post_build
If installed as dev dependency:
dart run flutter_post_build
Example Output
Input:
app-armeabi-v7a-release.apk
app-arm64-v8a-release.apk
app-x86_64-release.apk
app-release.apk
app-release.aab
Output:
my_app_1.2.2_v7a.apk
my_app_1.2.2_a64.apk
my_app_1.2.2_x86.apk
my_app_1.2.2_uni.apk
my_app_1.2.2_bun.aab
Notes
- APK and AAB builds are handled independently (as per Flutter build commands).
discardapplies only to APK variants, not App Bundles.- If a file already exists in the target directory, it will be skipped.
License
This project is licensed under the MIT License — see the LICENSE file for details.
Libraries
- flutter_post_build
- A command-line tool to rename and organize Flutter build artifacts.