Reputation: 2175
I am following the instructions to deploy a Flutter app to the play store. https://flutter.dev/docs/deployment/android
I have reached the point title Create a Keystore
I am prompted to enter a password, my name, etc, and get through all of the steps in that process until I say "yes" and then I receive the following error
[Storing ~/key.jks]
keytool error: java.io.FileNotFoundException: ~\key.jks (The system cannot find the path specified)
java.io.FileNotFoundException: ~\key.jks (The system cannot find the path specified)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
at sun.security.tools.keytool.Main.doCommands(Main.java:1144)
at sun.security.tools.keytool.Main.run(Main.java:343)
at sun.security.tools.keytool.Main.main(Main.java:336)
I'm not sure how to get around this.
I've tried using each of the following commands: "C:\Program Files\Android\Android Studio\jre\bin\keytool" -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
this one results in the error above.
I've also tried: "C:\Program Files\Java\jre-10.0.1\bin\keytool" -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
this one results in the following error:
[Storing ~/key.jks]
keytool error: java.io.FileNotFoundException: ~\key.jks (The system cannot find the path specified)
java.io.FileNotFoundException: ~\key.jks (The system cannot find the path specified)
at java.base/java.io.FileOutputStream.open0(Native Method)
at java.base/java.io.FileOutputStream.open(Unknown Source)
at java.base/java.io.FileOutputStream.<init>(Unknown Source)
at java.base/java.io.FileOutputStream.<init>(Unknown Source)
at java.base/sun.security.tools.keytool.Main.doCommands(Unknown Source)
at java.base/sun.security.tools.keytool.Main.run(Unknown Source)
at java.base/sun.security.tools.keytool.Main.main(Unknown Source)
I have also tried adding each of these directories to path and instead issuing the command laid out in the docs: keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
but that gives me this error: 'keytool' is not recognized as an internal or external command,
Anybody run into this before?
Upvotes: 4
Views: 4791
Reputation: 1355
As per my understanding, you need to create keystore(.jks) file.
- goto Build-->Generate Signed Apk-->select apk-->select path with filename(which you want to create newly)-->set all parameters(required information)-->finally select release and checkmark v1 and v2-->then find your apk in release folder-->upload this apk to play store.
Or
just put correct path in below command line
keytool -genkey -v -keystore -keyalg RSA -keysize 2048 -validity 10000 -alias key
:)
Upvotes: 1
Reputation: 51722
In Linux and MacOS, '~' is a shortcut for "my home directory", so ~/key.jks
expands to, for example, /home/fluttercoder/key.jks
. Obviously, this folder doesn't exist on Windows.
Choose a different folder on Windows, for example, c:\Users\fluttercoder\keys\
, so the file becomes c:\Users\fluttercoder\keys\key.jks
. (Be careful of any Windows folders with spaces in. Best to avoid them; otherwise enclose them in double quotes.)
Upvotes: 3