Skip to main content

Generate Release Version

Android Release Configuration

Before generating a release version of your Android app, you need to ensure the correct signing configuration is set up in your build.gradle file.

Generate Keystore File

If you haven't already generated a keystore file, follow these steps:

  1. Open terminal

  2. Navigate to your project's android/app directory

  3. Run the following command:

    For Mac/Linux:

    keytool -genkey -v -keystore YOUR-KEYSTORE-FILE.jks -keyalg RSA -keysize 2048 -validity 10000 -alias YOUR-ALIAS

    For Windows:

    keytool -genkey -v -keystore YOUR-KEYSTORE-FILE.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias YOUR-ALIAS
  4. Follow the prompts to set up your keystore.

Update Signing Configuration

  1. Open android/app/build.gradle
  2. Locate the signingConfigs block
  3. Make sure the release configuration is set to release instead of debug
    buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled false
shrinkResources false
}
}
}
  1. Update the contents at android/key.properties with your keystore details.

Example Values

storePassword=123456          //Replace with password you set when generating keystore
keyPassword=123456 //Replace with password you set when generating keystore
keyAlias=upload //Replace with alias you set when generating keystore
storeFile=keystore.jks //Replace with keystore file name
note

This will be the same value which you provided when generating the keystore (.jks file)

Release Configuration

note

The keystore file should be placed in the android/app directory

danger
  • Never commit your keystore file or passwords to version control
  • Store your keystore file securely
  • Keep a backup of your keystore file - if you lose it, you won't be able to update your app on the Play Store

Generating Release APK

  1. Open terminal in your project root directory
  2. Run the following command:
    flutter build apk --release
  3. The release APK will be generated at:
    build/app/outputs/flutter-apk/app-release.apk

iOS Release Configuration

For iOS release builds:

  1. Open Xcode
  2. Select your target
  3. Go to Signing & Capabilities
  4. Ensure you have:
    • Valid provisioning profile
    • Valid distribution certificate
    • Correct team selected
    • Correct bundle identifier

Generating iOS Release

  1. Open terminal in your project root directory
  2. Run the following command:
    flutter build ios --release
  3. Open the generated Xcode project:
    open ios/Runner.xcworkspace
  4. In Xcode:
    • Select "Any iOS Device" as the build target
    • Go to Product > Archive
    • Follow the steps to upload to App Store Connect

Troubleshooting

Common issues and solutions:

  • Android signing issues:

    • Verify keystore file exists in correct location
    • Check keystore passwords are correct
    • Ensure signingConfig is set to release
  • iOS signing issues:

    • Verify certificates are valid in Apple Developer account
    • Check provisioning profiles are up to date
    • Ensure bundle identifier matches your app's configuration