michaeldebo
michaeldebo

Reputation: 3215

Execution failed for task ':app:packageReleaseBundle'. Can't build app bundle

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?

Upvotes: 1

Views: 846

Answers (2)

michaeldebo
michaeldebo

Reputation: 3215

As dumb as this may sound, I spent 24 hours on this and all I had to was enter flutter clean

Upvotes: 1

Pierre
Pierre

Reputation: 17417

You have keyAlias=keystore in your key.properties while it looks like the alias you created is named upload (see in your keytool export command).

Repleace with keyAlias=upload and that should work if your password is correct.

Upvotes: 0

Related Questions