Creating An Upload Keystore File: No Such Algorithm Exception

Creating An Upload Keystore File: No Such Algorithm Exception

While trying to hit my deadline, I come across the following error while deploying my app on the Google Play Console, and this is how I resolved it.

No Such Algorithm Exception

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:signReleaseBundle'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Failed to read key upload from store "keystore file path": Integrity check failed: java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256 not available

Note: This article assumes you have gone through the steps over at flutter.dev and you are trying to sign your project on your Google Play Developer Console for the first time.

Creating an upload Keystore file on Mac/Linux using the following command resulted in an error.

keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload

One of the reasons may be that:

  • The keytool command might not be in your path

To solve this error

We will need to navigate to where your upload-keystore.jks file was created. This is usually located in the home directory.

cd $HOME

If you prefer to use your terminal or navigate to the home folder using file manager and delete the upload-keystore.jks.

 rm upload-keystore.jks

Next, run the following command in order to find the file path of where the Java binary is located

flutter doctor -v
  • This command will give you a list with information about the installed tooling and additional diagnostic information.

image.png

Under the labeled [✓] Android toolchain

The java binary path is shown Java binary at:

Copy the path depending on where it is located depending on how your system is set up and replace java with /snap/android-studio/115/android-studio/jre/bin/java

replace java at the end with keytool* command as shown below and complete the app signing process.

/snap/android-studio/115/android-studio/jre/bin/keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload

Using these steps you should now be able to build your app bundle or apk and upload it on the google play store with the created upload-keystore.jks file. Just remember to back up this file, just in case of anything. ✌️