Flutter "Gradle task assembleRelease failed" (Android) in CI
flutter build apk --release runs the Android Gradle assembleRelease task. When it "failed with exit code 1", the real error - signing config, R8/ProGuard shrinking, or an unresolved dependency - is in the Gradle output printed above the wrapper line.
What this error means
A flutter build apk --release or flutter build appbundle job ends with "Gradle task assembleRelease failed with exit code 1". The headline is generic; the actionable line appears earlier in the Gradle log.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lintVitalAnalyzeRelease'.
Running Gradle task 'assembleRelease'...
Gradle task assembleRelease failed with exit code 1Common causes
An underlying release-only Gradle failure
Tasks that only run in release builds (R8 shrinking, lintVital, signing) fail, but Flutter reports only the wrapper exit code.
Missing or misconfigured signing for release
Release builds require a valid keystore and signingConfigs; a missing key or key.properties makes the release task fail where debug succeeds.
How to fix it
Run the Android release build with a stacktrace
Surface the real Gradle error instead of the wrapper message.
flutter build apk --release -v
cd android && ./gradlew assembleRelease --stacktrace --infoProvide signing config from CI secrets
- Decode the keystore from a base64 secret into the runner.
- Write
android/key.propertieswith the store/key passwords from secrets. - Reference it from
signingConfigs.releaseinapp/build.gradle.
storeFile=../app/upload-keystore.jks
storePassword=${{ secrets.STORE_PASSWORD }}
keyAlias=upload
keyPassword=${{ secrets.KEY_PASSWORD }}How to prevent it
- Pin Flutter, JDK, AGP, and Gradle versions together in CI.
- Inject keystore and key.properties from secrets, never commit them.
- Read the Gradle output above the wrapper line, not just the exit code.