When Running `flutter build apk`, Gradle Task `assembleRelease` Failed with Exit Code 1 and APK is Not Created
Android
2019-09-13 10:45 (7 years ago)

While developing an app with Flutter, there are no issues when debugging with Android Studio.
However, when running flutter build apk,
Gradle task assembleRelease failed with exit code 1
is displayed and no APK is created.
Referencing this StackOverflow article:
Based on the steps outlined:
1. Open gradle-wrapper.properties,
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
and change
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
(downgrade)
2. Open build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0-alpha09'
and change
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
3. Run flutter clean and then re-run flutter build apk.
By doing this, you will be able to see the cause of the error.
In my case, the issue was due to using a library that was not compatible with AndroidX. I opened pubspec.yaml and upgraded to a compatible version to resolve the issue.
Once the problem is resolved, you can revert the downgraded changes mentioned above.
Please rate this article (No signup or login required)
Current rating: 5.0 (2)
Related posts
Building an Android App with Flutter and Enabling App Launch from https:// URLs Using AppLinks
When the SHA256 of the Keystore is Not Displayed with Keytool During Android App Development
Downgrading Flutter SDK to Version 1.x
The App Crashes When Using FlutterDownloader.initialize() with flutter_downloader
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.
We look forward to discussing your development needs.