In this article I'll share with you how I fixed a failed
flutter build app bundle command.
When I ran
flutter build app bundle in my terminal I got the below error.
Execution failed for task ':app:signReleaseBundle'. > A failure occurred while executing com.android.build.gradle.internal.tasks.FinalizeBundleTask$BundleToolRunnable > Failed to read key upload from store "/Users/<your folder name>/upload-keystore.jks": Integrity check failed: java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256 not available * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 8s
The likely cause of this error is because the java version the app is built with is different for the java version being used to generate the signing key.
To fix run
Run flutter doctor -v
... [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc2) • Android SDK at /Users/<your folder path>/Library/Android/sdk • Platform android-33, build-tools 34.0.0-rc2 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763) • All Android licenses accepted. ...
Prefix the keygen command to point to the java version used to build your app and run you keygen command as shown below.
/Applications/"Android Studio.app"/Contents/jre/jdk/Contents/Home/bin/keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload
flutter build appbundle and your build will be successful