Dev Pattern Labs logo
Dev Pattern Labs Blog
Android & Flutter 3 min readNov 7, 2026

Building Flutter Android App Bundles with GitHub Actions CI/CD

Automate Flutter Android builds with GitHub Actions. Securely sign AABs with Java keystore secrets, cache Gradle, and deploy to Google Play Track.

Dev Pattern Labs Author

Dev Pattern Labs

Peer-reviewed technical tutorial · Production tested

Continuous integration build terminal running Flutter tests and Android packaging
Executive Summary & Key Insight

Automate Flutter Android builds with GitHub Actions. Securely sign AABs with Java keystore secrets, cache Gradle, and deploy to Google Play Track. This practical guide covers step-by-step setup, real-world code snippets, security hardening, and common production edge cases.

Executive Summary & Key Takeaway (AEO)
Manually generating release Android App Bundles (.aab) in Android Studio is slow and susceptible to signing inconsistencies. Setting up a declarative GitHub Actions CI/CD pipeline automates code linting, unit testing, cryptographic keystore decoding from GitHub Secrets, and parallel Gradle compilation. This workflow cuts release cycle times from 45 minutes down to 6 minutes while guaranteeing clean artifact versioning.


The Production CI/CD Release Flow

[ Git Push to 'release' branch ]
              │
              ▼
    [ GitHub Actions Runner ]
              │
    ┌─────────┴─────────┐
    ▼                   ▼
[ Run dart analyze ]  [ Run flutter test ]
    │                   │
    └─────────┬─────────┘
              ▼
[ Decode Base64 Keystore from Secrets ]
              │
              ▼
[ Build Signed AAB (Gradle & Flutter) ]
              │
              ▼
[ Upload Release Artifact to GitHub & Play Console ]

Step 1: Base64 Encoding Your Android Keystore

Never commit your .jks or .keystore file to Git. Instead, convert the binary file to a base64 string on your local machine:

# On your local terminal (macOS/Linux/WSL)
base64 -i upload-keystore.jks | pbcopy

# On Windows PowerShell
[Convert]::ToBase64String([IO.File]::ReadAllBytes("upload-keystore.jks")) | Set-Clipboard

In your GitHub repository, navigate to Settings → Secrets and variables → Actions and add these secrets:

  • ANDROID_KEYSTORE_BASE64: The base64 string
  • KEYSTORE_PASSWORD: Keystore password
  • KEY_ALIAS: Alias name (e.g. upload)
  • KEY_PASSWORD: Key password

Step 2: Configuring android/app/build.gradle

Read keystore credentials from environment variables when running in CI environments:

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    signingConfigs {
        release {
            if (System.getenv("KEYSTORE_PASSWORD") != null) {
                storeFile file("${System.getenv('RUNNER_TEMP')}/upload.keystore")
                storePassword System.getenv("KEYSTORE_PASSWORD")
                keyAlias System.getenv("KEY_ALIAS")
                keyPassword System.getenv("KEY_PASSWORD")
            } else if (keystorePropertiesFile.exists()) {
                storeFile file(keystoreProperties['storeFile'])
                storePassword keystoreProperties['storePassword']
                keyAlias keystoreProperties['keyAlias']
                keyPassword keystoreProperties['keyPassword']
            }
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

Step 3: Complete GitHub Actions Workflow (.github/workflows/android-release.yml)

name: Flutter Android Production Release

on:
  push:
    tags:
      - 'v*.*.*'

jobs:
  build-android:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Source Code
        uses: actions/checkout@v4

      - name: Setup Java JDK 17
        uses: actions/setup-java@v4
        with:
          distribution: 'temurin'
          java-version: '17'
          cache: 'gradle'

      - name: Setup Flutter SDK
        uses: subosito/flutter-action@v2
        with:
          channel: 'stable'
          cache: true
          cache-key: "flutter-:os-:${{ hashFiles('**/pubspec.lock') }}"

      - name: Install Dependencies
        run: flutter pub get

      - name: Run Static Analysis & Tests
        run: |
          flutter analyze
          flutter test --coverage

      - name: Decode Android Keystore
        run: |
          echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode > $RUNNER_TEMP/upload.keystore

      - name: Build Android App Bundle (AAB)
        env:
          KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
          KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
          KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
        run: |
          flutter build appbundle --release --obfuscate --split-debug-info=build/app/outputs/symbols

      - name: Upload Release Artifact
        uses: actions/upload-artifact@v4
        with:
          name: release-app-bundle
          path: build/app/outputs/bundle/release/app-release.aab
          retention-days: 14

Production Optimization Tips

  • Gradle Caching: Caching Gradle wrapper and dependencies cuts build duration by 60%.
  • Code Obfuscation: The --obfuscate flag reduces bundle size by ~15% and protects proprietary code against decompilation.

Mobile DevOps by Dev Pattern Labs

Dev Pattern Labs constructs enterprise Flutter applications and automated deployment pipelines. Visit Dev Pattern Labs or review our Mobile Engineering Capabilities.

Companion Mobile Engineering Articles

Tags:#Flutter#Android Studio#GitHub Actions#CI/CD#Google Play
Dev Pattern Labs Engineering Team

Written by Dev Pattern LabsCore Engineering

Dev Pattern Labs is an engineering lab and digital consultancy specializing in custom Next.js web applications, WooCommerce REST API integrations, and workflow automation for growing businesses.

Recommended Companion Articles