Chapter 17 - getting keystore password error

Hi,
I am trying to build the android app (page 575) and am getting an error:
When I got it the first time, I assumes I had made a mistake with the password like it says.
I tried to rerun the keytool to what I thought would overwrite the previous one, but it didn’t.
it said I already had an alias of “recipes” so I changed the keytool command line to use an alias of “recipes1” and a filename of "recipes1.jks
(I need to find out the corect way to completely wipe out what I did so I could have started over with the same alias) but at any rate… I did run the keytool again and then the build, but got the same error about the password. I was very careful with inputting the password and in putting it in the key.properties file. Also, the recipes1.jks file is in fact in the root directory of the started project.
So can anyone help with pointing me in the right direction to figure out this error?
I am using a mac,if that makes any difference…

this is the error message:
Failed to read key recipes1 from store “/Volumes/…morefoldernameshere…/projects/starter/recipes1.jks”: keystore password was incorrect

thank you so much!
ginny

that’s tricky, the assumption is that the password in the properties file doesn’t match what you set when creating the store. As long as you didn’t upload to the App Store yet, maybe try nuking the original and going back to square one?

ok I do want to try that.
So what steps to “nuk”? like delete the recipes.jks file and then how do I get rid of some alias that it is “remembering” I don’t know where it got that alias already existed error.
also, just stating the obvious, I kept the braces in the key.properties file right?
storePassword={mypass}
keyPassword={mypass}

yes?
thanks for getting back so fast. Here I thought I was going to finish the book today… ugh…

oh no… please remove the braces “{”, “}” they are meant be part of the placeholder and should be replaced with your password.

… just goes to show that there is always some implicit assumptions in every direction. Sorry about that.

LOL…that was going to be my next “try” thanks for confirming that.
I will also notate in the book (page 575) where it talks about getting an error, that all I have to do is delete that .jks file to redo the whole process again… thank you for your help!!!..
So now…
I did get a new error…

Failed to read key recipes from store “/Volumes/…/projects/starter/recipes.jks”: Integrity check failed: java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256 not available

what…??? yikes!! maybe I didn’t “nuk” enough to start over??

No, this one seems to be Java issue, maybe the discussion here will help: Error building AAB - Flutter (Android) - Integrity check failed: java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256 not available - Stack Overflow

yes.looks like it… I was just reading stackoverflow… so I remember I first ran into an issue when I first tried to do that “keytool” command on page 572 and got an error that said JDK wasn’t installed and it took me to a new download for JDK SE 17. I think that could be the first place I went down the wrong road. I think I needed to fix a path or something first to make that command work. Maybe a note in the book there would be a good idea…

So yes, now I am looking at the flutter java version and my terminal version and trying to get them to match. My Android Studio application name has spaces in it and the path setting is giving me errors so I am trying to find out the correct syntax for a MAC to set a path with spaces…
ugh…
thanks for heads up confirmation of java issue…

Just want to say a big thank you!!!.. it did work as stackoverflow suggested using the complete path in the keytool command.
I think I will have to add that to the path though so I dont run into this again.
Thanks for your speedy help!!!
gc

FYI:
Got to the upload to Play Store and got rejected the upload because the target was 29 and not 30.
Also, the store wanted a privacy policy link under Data Security.
So that all looks new from when the book was written.
Again, thanks so much!!!
gc

The answer is here: https://stackoverflow.com/a/67632064/15178751

The java of Android Studio is of an older version than the Java bundled with macOS Monterey for M1. It cannot decrypt the signature generated by the latter.

The solution is :

  • delete the file starter/recipes1.jks
  • create another one using the keytool of Android Studio by typing

$ /Applications/Android\ Studio.app/Contents/jre/Contents/Home/bin/keytool -genkey -v -keystore recipes1.jks -keyalg RSA -keysize 2048 -validity 10000 -alias recipes1

  • Then build the bundle again.

$ flutter build appbundle

Side note for @mkatz : congrats for the good job. Very careful writing. Thanks.

1 Like

Thanks for the update and compliment :relaxed: