1

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?

michaeldebo
  • 3,065
  • 4
  • 14
  • 20
  • It looks like there is a problem in your flutter config. Could you share what your signing config looks? – Pierre Feb 03 '21 at 21:20
  • Also, googling the error message returned this as first link: https://stackoverflow.com/questions/23750259/certificate-chain-not-found-how-to-fix-and-publish-to-google-play-store – Pierre Feb 03 '21 at 21:21
  • I 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 Feb 03 '21 at 21:23
  • Do you mean what's in my key.properties file? – michaeldebo Feb 03 '21 at 21:23
  • Here's what's in my key.properties file: storePassword=Test*** keyPassword=Test*** keyAlias=keystore storeFile=/Users/****/Desktop/***/matto_flutter/keystore.jks – michaeldebo Feb 03 '21 at 21:28
  • When 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. – michaeldebo Feb 03 '21 at 21:47
  • When 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. – Pierre Feb 04 '21 at 10:23

2 Answers2

1

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

michaeldebo
  • 3,065
  • 4
  • 14
  • 20
0

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.

Pierre
  • 15,865
  • 4
  • 36
  • 50
  • When 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 Feb 04 '21 at 14:42
  • Thanks 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. – michaeldebo Feb 04 '21 at 14:52
  • Does 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 Feb 04 '21 at 15:40
  • The commands you shared show that the upload keystore you created was named 'keystore.jks' so that's the one you need to reference. – Pierre Feb 04 '21 at 15:52
  • When I use the correct Alias and path ending in keystore, I continue to get the error that is the title of this post. – michaeldebo Feb 04 '21 at 16:00
  • What do you mean by "the correct alias"? Do you mean "upload"? Did you use the command from https://stackoverflow.com/questions/23750259/certificate-chain-not-found-how-to-fix-and-publish-to-google-play-store to check what were the available aliases in the keystore file you're using? – Pierre Feb 04 '21 at 18:27