keytool to bulid release

hi i hava a problem. I want to create a release Version. I installed JDK x86 7u80. Set a environment Variable JAVA_HOME

now i  open cmd and tap

md Keystores

(enter)

cd Keystores

(enter)

keytool -genkey -v -keystore mykeystore.keystore -alias aliasname -keyalg RSA -validity 999999

(enter)

now there is a error: keytool not found. Why?
Here is the Manuel
 

https://coronalabs.com/blog/2014/08/26/tutorial-understanding-android-app-signing/

Thier should be a way to locate the leytool in the build menu.

it doesnt go.

cd C:\Program Files (x86)\Java\jdk1.7.0_80\bin\

(enter)

keytool -genkey -v -keystore mykeystore.keystore -alias aliasname -keyalg RSA -validity 999999

(enter)

Now i tip the name etc.

At the end there is the error

image: http://www.bilder-upload.eu/show.php?file=4aca30-1469555248.png

Acces denied

You can’t blindly copy that command.

mykeystore.keystore is a file you are creating. It needs to be in a folder on your computer where you will remember where it is and won’t loose it. And certainly “aliasname” shouldn’t actually be “aliasname” but the name you want to call this particular keystore.  Let me back up a second.

Android stores encryption keys for your apps in a keystore file. Each keystore file can store multiple keystores (aliases). You can choose to have one file with many aliases or you can have multiple keystore files with a single keystore alias inside. Or you can create just one and use it for all your apps.

But regardless you cannot run keystore from the C:\Program Files (x86) path since it’s read only and it’s a bad place to save your keystores anyway.  Since mykeystore.keystore is a file name,  you can use a full path to specify it. Likewise you can run keytool by putting the full path in front of the command.

Try this:

cd %HOMEPATH%

C:\Program Files (x86)\Java\jdk1.7.0_80\bin\keytool -genkey -v -keystore android.keystore -alias release -keyalg RSA -validity 999999

You will be prompted for two passwords: one for the keystore file and one for the alias that you’re adding. While best security practices would say to use two different strong passwords for each (and if you later add more aliases to the keystore file, you might want a different password for each alias) many people use the same password for both for ease in remembering each.

This should create a file called android.keystore and store it in your home directory on your computer. Now in Corona SDK’s build screen for the “Keystore” field, browse to your home directory and select “android.keystore”. Once it loads (and will probably ask for a password) enter the password you used for the keystore. Then in the “Key Alias” field, “release” should show up as the only option. Select it and put in the password you used for the alias.

And you should be all set.

Rob

I used to use game salad and I still like thier guide to make a keystore
http://help.gamesalad.com/gamesalad-cookbook/publishing/4-android-publishing/4-02-creating-a-keystore/

thanks to you all :slight_smile: Finally get it work…

It’s been a while since I built a new version of my app (last time I used corona 2731) but now when trying to build for android using corona 2970, the key alias is blank.  The keystore file shows up fine, when I use keytool to look inside the keystore file it does indicate it has an alias, so??? Can i simply create a new android keystore for the app’s update version or do I have to use the one I have been using previously for this app. and if so, how do i find the key alias, is it another file? Any help much appreciated.

Thier should be a way to locate the leytool in the build menu.

it doesnt go.

cd C:\Program Files (x86)\Java\jdk1.7.0_80\bin\

(enter)

keytool -genkey -v -keystore mykeystore.keystore -alias aliasname -keyalg RSA -validity 999999

(enter)

Now i tip the name etc.

At the end there is the error

image: http://www.bilder-upload.eu/show.php?file=4aca30-1469555248.png

Acces denied

You can’t blindly copy that command.

mykeystore.keystore is a file you are creating. It needs to be in a folder on your computer where you will remember where it is and won’t loose it. And certainly “aliasname” shouldn’t actually be “aliasname” but the name you want to call this particular keystore.  Let me back up a second.

Android stores encryption keys for your apps in a keystore file. Each keystore file can store multiple keystores (aliases). You can choose to have one file with many aliases or you can have multiple keystore files with a single keystore alias inside. Or you can create just one and use it for all your apps.

But regardless you cannot run keystore from the C:\Program Files (x86) path since it’s read only and it’s a bad place to save your keystores anyway.  Since mykeystore.keystore is a file name,  you can use a full path to specify it. Likewise you can run keytool by putting the full path in front of the command.

Try this:

cd %HOMEPATH%

C:\Program Files (x86)\Java\jdk1.7.0_80\bin\keytool -genkey -v -keystore android.keystore -alias release -keyalg RSA -validity 999999

You will be prompted for two passwords: one for the keystore file and one for the alias that you’re adding. While best security practices would say to use two different strong passwords for each (and if you later add more aliases to the keystore file, you might want a different password for each alias) many people use the same password for both for ease in remembering each.

This should create a file called android.keystore and store it in your home directory on your computer. Now in Corona SDK’s build screen for the “Keystore” field, browse to your home directory and select “android.keystore”. Once it loads (and will probably ask for a password) enter the password you used for the keystore. Then in the “Key Alias” field, “release” should show up as the only option. Select it and put in the password you used for the alias.

And you should be all set.

Rob

I used to use game salad and I still like thier guide to make a keystore
http://help.gamesalad.com/gamesalad-cookbook/publishing/4-android-publishing/4-02-creating-a-keystore/

thanks to you all :slight_smile: Finally get it work…

I opened command prompt and type

md Keystores

(enter)

cd %HOMEPATH%

(enter)

C:\Program Files (x86)\Java\jdk1.7.0_80\bin\keytool -genkey -v -keystore android.keystore -alias release -keyalg RSA -validity 999999

(enter)

I get this “C:Program is not recognize as an internal or external command, operable program or batch file”.

My enviromental variables are “Java_Home” with the value “C:\Program Files (x86)\Common Files\Java\Java Update”. What is wrong? I have a windows and I have downloaded the same java package name, the “jdk1.7.0_80”. I have been trying to release for a month and I am very frustrated. Please answer and please be  very specific Rob, I want to release my game 

You probably need quotes around the “C:\Program Files (x86)\Java\jdk1.7.0_80\bin\keytool.exe” 

Rob

It did not result in an error but the command prompt says, “The system cannot find the path specified”. What do you think is wrong?

Unfortunately I can’t see your computer. You indicated above that your JAVA_HOME environment variable is pointing to a folder that has a subdirectory named “java update”. If that’s part of the path, you probably need to include it.

Another option is to go the opposite direction. Use the CD command to change directory to the location that holds keytool.exe and do something more like:

keytool.exe -genkey -v -keystore %HOMEPATH%\android.keystore -alias release -keyalg RSA -validity 999999

or if you want it to end up in your Keystores folder:

keytool.exe -genkey -v -keystore %HOMEPATH%\Keystores\android.keystore -alias release -keyalg RSA -validity 999999

That of course assumes that you were actually in %HOMEPATH% when you did the “md Keystores” command earlier.

Rob

Rob thank you for your time. I am going to ask to help me to start over step by step. I am going to download the Se 7u80 (x86) and redo it again. 

  •     I downloaded java again. I am using wizard, should I download the development tools or the source code?

Go to:  http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

In the 112 block, click on the accept radio button then click on: jdk-8u112-windows-i586.exe

Download and install it.

In your “Search Windows” box type “cmd”. It should give you an option to run the “Command Prompt”.

In the Window that opens type:

cd C:\"Program Files (x86)

cd Java\jdk1.8.0\_112\bin

next type:

md %HOMEPATH%\keystores

This may give you an error if you’ve already created the directory.  Next type in:

keytool.exe -genkey -v -keystore %HOMEPATH%\keystores\android.keystore -alias release -keyalg RSA -validity 999999

It’s should start asking you a bunch of questions that you will have to provide answers that make sense for you. The sequence should go something like:

C:\Program Files (x86)\Java\jdk1.8.0\_112\bin\>keytool.exe -genkey -v -keystore %HOMEPATH%\keystores\android.keystore -alias release -keyalg RSA -validity 999999 Enter keystore password: Re-enter new password: What is your first and last name? &nbsp; [Unknown]:&nbsp; Rob Miracle What is the name of your organizational unit? &nbsp; [Unknown]:&nbsp; Developer Relations What is the name of your organization? &nbsp; [Unknown]:&nbsp; Corona Labs What is the name of your City or Locality? &nbsp; [Unknown]:&nbsp; Austin What is the name of your State or Province? &nbsp; [Unknown]:&nbsp; TX What is the two-letter country code for this unit? &nbsp; [Unknown]:&nbsp; US Is CN=Rob Miracle, OU=Developer Relations, O=Corona Labs, L=Austin, ST=TX, C=US correct? &nbsp; [no]:&nbsp; yes Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 999,999 days &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for: CN=Rob Miracle, OU=Developer Relations, O=Corona Labs, L=Austin, ST=TX, C=US Enter key password for \<release\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (RETURN if same as keystore password): [Storing \Users\rob\keystores\android.keystore] C:\Program Files (x86)\Java\jdk1.8.0\_112\bin\>

Now this is as “Copy and Paste” as I can make this. Java may or may not install in the directory that it installed for me.

How you bring up the command prompt may be different.

You may choose to have a different password for the .keystore file and for the “release” keystore. In my example I chose to use the same password for both.

Your Keystore file will be in C:\Users\yourname\keystores\android.keystore and you can tell Corona to go to that folder and use the keystore you created.

Rob

Thanks a lot Rob, I can not thank you enough, for your patience. :rolleyes: