Execution failed for task ':app:packageReleaseBundle'. Can't build app bundle
As dumb as this may sound, I spent 24 hours on this and all I had to was enter flutter clean
michaeldebo
Updated on December 27, 2022Comments
-
michaeldebo over 1 year
I get the title and the text below when I try and fail to build an .aab file using flutter build appbundle:
java.util.concurrent.ExecutionException: java.lang.RuntimeException: jarsignerfailed with exit code 1 : jarsigner: Certificate chain not found for: keystore. keystore must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.
I had to reset my signing key. The google developer support had me generate a new .jks file with the following command line which I ran from within my project folder:
keytool -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore keystore.jks
He then instructed me to convert this file into a .pem file using this command:
keytool -export -rfc -alias upload -file upload_certificate.pem -keystore keystore.jks
I then emailed him the upload_certificate.pem file. I immediately noticed that the keystore.jks file was red in the sidebar and I get this upon clicking on it:
"The file 'keystore.jks' is not associated with any file type. Please define the association:"
The .pem file is also red, but clicking on it shows the text that makes up the key.
Do I need to reset the signing key again and do something different? Is there a way to fix the issue causing this error?
-
Pierre over 3 yearsIt looks like there is a problem in your flutter config. Could you share what your signing config looks?
-
Pierre over 3 yearsAlso, googling the error message returned this as first link: stackoverflow.com/questions/23750259/…
-
michaeldebo over 3 yearsI saw that link. When i tried the recommend command line, I get this error: keytool error: java.lang.Exception: Keystore file does not exist: formconnect.keystore java.lang.Exception: Keystore file does not exist: formconnect.keystore
-
michaeldebo over 3 yearsDo you mean what's in my key.properties file?
-
michaeldebo over 3 yearsHere's what's in my key.properties file: storePassword=Test*** keyPassword=Test*** keyAlias=keystore storeFile=/Users/****/Desktop/***/matto_flutter/keystore.jks
-
michaeldebo over 3 yearsWhen I try this command jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore C:\Users***\Desktop***\matto_flutter.keystore matto_flutter.apk keystore I get this response: The operation couldn’t be completed. Unable to locate a Java Runtime that supports jarsigner.
-
Pierre over 3 yearsWhen you run the command, you have to replace
formconnect.keystore
with the path to YOUR keystore file, i.e.keystore.jks
. That will give list you the aliases of the keys in your keystore.
-
-
michaeldebo over 3 yearsWhen I replace keyAlias to equaling upload, the error changes to: Execution failed for task ':app:validateSigningRelease'. > Keystore file '/Users/****/Desktop/****/matto_flutter/android/app/upload.jks' not found for signing config 'release'.
-
michaeldebo over 3 yearsThanks for the help. When I replace the keyAlias with upload, which is the keyAlias, if I change the storeFile to end in /alias.jks I get this error instead: Execution failed for task ':app:validateSigningRelease'. > Keystore file '/Users/****/Desktop/****/matto_flutter/android/app/upload.jks' not found for signing config 'release'. If I leave the keystore file ending in keystore.jks I get the same error as before.
-
Pierre over 3 yearsDoes the file '/Users/****/Desktop/****/matto_flutter/android/app/upload.jks' actually exist? It looks like you're just pointing to a keystore file that doesn't exist.
-
Pierre over 3 yearsThe commands you shared show that the upload keystore you created was named 'keystore.jks' so that's the one you need to reference.
-
michaeldebo over 3 yearsWhen I use the correct Alias and path ending in keystore, I continue to get the error that is the title of this post.
-
Pierre over 3 yearsWhat do you mean by "the correct alias"? Do you mean "upload"? Did you use the command from stackoverflow.com/questions/23750259/… to check what were the available aliases in the keystore file you're using?