Flutter Deployment
Once you've built a Flutter application, the next step is deployment, which means preparing and publishing your app on the Google Play Store (Android) or the Apple App Store (iOS). Below is a step-by-step guide for deploying your Flutter app on both platforms.
1. Preparing for Deployment (Common Steps for Android and iOS) Update pubspec.yamlMake sure your pubspec.yaml file contains a proper app name, description, and dependencies.
  name: my_flutter_app
  description: A new Flutter application
  version: 1.0.0+1
- version: 1.0.0+1
 - 1.0.0 → App version (Major.Minor.Patch)
 - +1 → Build number (increases with every new build)
 
Optimize Assets and Code
- Remove unused assets and code.
 - Minify and obfuscate Dart code using:
 - Reduce app size by enabling ProGuard (Android).
 
flutter build apk --release --obfuscate --split-debug-info=debug-info
1. Deploying Flutter App on Android
Update Android App Manifest (AndroidManifest.xml) Located at:android/app/src/main/AndroidManifest.xml
Set App Name:
  <application 
      android:label="My Flutter App" 
      android:icon="@mipmap/ic_launcher">
Set Permissions (if required):
  <uses-permission 
      android:name="android.permission.INTERNET" />
Configure build.gradle Files
Project-level android/build.gradleEnsure the minimum SDK version is set correctly:
ext.kotlin_version = '1.7.10'
App-levelandroid/app/build.gradle
Set minSdkVersion and targetSdkVersion
  defaultConfig {
    applicationId "com.example.myflutterapp"
    minSdkVersion 21
    targetSdkVersion 34
    versionCode 1
    versionName "1.0.0"
  }
Generate Signed APK or App Bundle
To publish your app, you need to generate a signed APK or App Bundle (AAB).
Generate a Keystore (only needed once) Run the following command:
  keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-key-alias
Move the generated my-release-key.jks file to:
android/app/
Update key.properties File
Create a file android/key.properties and add:
storeFile=../app/my-release-key.jks
storePassword=my_store_password
keyPassword=my_key_password
keyAlias=my-key-alias
Edit android/app/build.gradle:
  android {
    signingConfigs {
        release {
            storeFile file('../key.properties')
            storePassword 'my_store_password'
            keyPassword 'my_key_password'
            keyAlias 'my-key-alias'
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
  }
Build APK or AAB
Run either of the following commands:
- For APK (smaller size, easier to distribute):
 - For App Bundle (recommended for Play Store):
 
flutter build apk --release
flutter build appbundle
Upload to Google Play Store
- Go to Google Play Console.
 - Create a new app and fill in details.
 - Upload the AAB file under "Production" → "Release".
 - Fill in Store Listing, App Content, and Pricing.
 - Submit for review and publishing.
 
3. Deploying on iOS (App Store)
Install Xcode and Setup iOS Development Environment- Install Xcode from the Mac App Store.
 - Install CocoaPods:
 
sudo gem install cocoapods
Update iOS App Configuration
- Open ios/Runner.xcodeproj in Xcode.
 - Go to Runner → General → Identity and set:
 - Display Name: (App Name)
 - Bundle Identifier: (e.g., com.example.myflutterapp)
 - Version and Build Number
 
Setup Signing and Capabilities
- In Xcode, open Runner → Signing and Capabilities.
 - Enable Automatically manage signing.
 - Select your Apple Developer Team.
 - Ensure the app’s Bundle Identifier matches your App Store settings.
 
Build iOS App
Run on a Physical Device (iPhone)
Connect your iPhone via USB and run:
flutter build ios --release
Archive and Upload to App Store
- Open the Runner.xcworkspace in Xcode:
 - In Xcode, select Product → Archive.
 - Once archived, click Distribute App → App Store Connect.
 - Upload the build to App Store Connect.
 
open ios/Runner.xcworkspace
Submit App for Review
- Go to App Store Connect.
 - Select your app and go to App Store → Prepare for Submission.
 - Fill in app details, screenshots, and privacy policy.
 - Submit for App Store Review.