Flutter Build & Release

Learn how to build and release your Flutter applications

🚀 What is Build & Release?

Build & Release is the process of preparing your Flutter app for distribution. It compiles your code into platform-specific formats like APK, AAB, IPA, or executables for different devices and app stores.


# Basic Flutter build command
flutter build apk

# Build for release mode
flutter build apk --release
                                    

Output:

✓ Built build/app/outputs/flutter-apk/app-release.apk (18.5MB)

Key Build Concepts

📱

Build Modes

Flutter has three build modes: Debug (for development), Profile (for performance testing), and Release (for production deployment with optimizations).

flutter build apk --debug
flutter build apk --profile
flutter build apk --release
🎯

Target Platforms

Flutter supports multiple platforms: Android (APK/AAB), iOS (IPA), Web (HTML/JS), and Desktop (Windows, macOS, Linux executables).

flutter build apk      # Android
flutter build ios      # iOS
flutter build web      # Web
flutter build windows  # Desktop
🔐

App Signing

Signing your app with digital certificates ensures authenticity and security. Android uses keystore files, while iOS uses provisioning profiles and certificates.

# Generate keystore
keytool -genkey -v -keystore my-key.jks \
-keyalg RSA -keysize 2048 -validity 10000
📦

Build Outputs

Build outputs are platform-specific files ready for distribution: APK/AAB for Android, IPA for iOS, and executable files for desktop platforms.

# Output locations
build/app/outputs/flutter-apk/
build/ios/iphoneos/
build/web/

🔹 Build Configuration

Configure your app's build settings in pubspec.yaml:

name: my_flutter_app
description: A new Flutter project
version: 1.0.0+1

environment:
  sdk: '>=3.0.0 <4.0.0'

dependencies:
  flutter:
    sdk: flutter

flutter:
  uses-material-design: true

Version Format:

1.0.0+1 → Version Name: 1.0.0, Build Number: 1

🔹 Release Checklist

Essential steps before releasing your Flutter app:

Pre-Release Steps:

  1. Update app version in pubspec.yaml
  2. Test app thoroughly on target devices
  3. Configure app signing (keystore/certificates)
  4. Update app icons and splash screens
  5. Review permissions in AndroidManifest.xml/Info.plist
  6. Build in release mode
  7. Test the release build
  8. Upload to app stores

🔹 Common Build Commands

Frequently used Flutter build commands:

# Clean build files
flutter clean

# Get dependencies
flutter pub get

# Build APK (Android)
flutter build apk --release

# Build App Bundle (Android)
flutter build appbundle --release

# Build for iOS
flutter build ios --release

# Build for Web
flutter build web --release

# Build for Windows
flutter build windows --release

🔹 Build Optimization

Optimize your Flutter app build size and performance:

# Split APK by ABI (reduces size)
flutter build apk --split-per-abi

# Obfuscate code (security)
flutter build apk --obfuscate --split-debug-info=./debug-info

# Analyze build size
flutter build apk --analyze-size

Size Reduction:

Split APKs can reduce app size by 30-40% per architecture

🧠 Test Your Knowledge

Which build mode should you use for production apps?