Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

keytool to bulid release
Started by t.kwant1 Jul 26 2016 09:30 AM

18 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

t.kwant1

[GLOBAL: userInfoPane.html]
t.kwant1
  • Observer

  • 16 posts
  • Corona SDK

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/



[TOPIC: post.html]
#2

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,808 posts
  • Enterprise

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

[TOPIC: post.html]
#3

t.kwant1

[GLOBAL: userInfoPane.html]
t.kwant1
  • Observer

  • 16 posts
  • Corona SDK

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



[TOPIC: post.html]
#4

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,075 posts
  • Enterprise

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



[TOPIC: post.html]
#5

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,808 posts
  • Enterprise

[TOPIC: post.html]
#6

t.kwant1

[GLOBAL: userInfoPane.html]
t.kwant1
  • Observer

  • 16 posts
  • Corona SDK

thanks to you all :) Finally get it work...



[TOPIC: post.html]
#7

jacques1

[GLOBAL: userInfoPane.html]
jacques1
  • Contributor

  • 318 posts
  • Corona SDK

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.



[TOPIC: post.html]
#8

jaime159castillo

[GLOBAL: userInfoPane.html]
jaime159castillo
  • Observer

  • 18 posts
  • Corona SDK

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 



[TOPIC: post.html]
#9

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,075 posts
  • Enterprise

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

 

Rob



[TOPIC: post.html]
#10

jaime159castillo

[GLOBAL: userInfoPane.html]
jaime159castillo
  • Observer

  • 18 posts
  • Corona SDK

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?



[TOPIC: post.html]
#11

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,075 posts
  • Enterprise

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

 

 



[TOPIC: post.html]
#12

jaime159castillo

[GLOBAL: userInfoPane.html]
jaime159castillo
  • Observer

  • 18 posts
  • Corona SDK

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. 



[TOPIC: post.html]
#13

jaime159castillo

[GLOBAL: userInfoPane.html]
jaime159castillo
  • Observer

  • 18 posts
  • Corona SDK

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


[TOPIC: post.html]
#14

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,075 posts
  • Enterprise

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?
  [Unknown]:  Rob Miracle
What is the name of your organizational unit?
  [Unknown]:  Developer Relations
What is the name of your organization?
  [Unknown]:  Corona Labs
What is the name of your City or Locality?
  [Unknown]:  Austin
What is the name of your State or Province?
  [Unknown]:  TX
What is the two-letter country code for this unit?
  [Unknown]:  US
Is CN=Rob Miracle, OU=Developer Relations, O=Corona Labs, L=Austin, ST=TX, C=US correct?
  [no]:  yes

Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 999,999 days
        for: CN=Rob Miracle, OU=Developer Relations, O=Corona Labs, L=Austin, ST=TX, C=US
Enter key password for <release>
        (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



[TOPIC: post.html]
#15

jaime159castillo

[GLOBAL: userInfoPane.html]
jaime159castillo
  • Observer

  • 18 posts
  • Corona SDK

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



[TOPIC: post.html]
#16

jaime159castillo

[GLOBAL: userInfoPane.html]
jaime159castillo
  • Observer

  • 18 posts
  • Corona SDK

It works!!!!!! Thankyou so much Rob!!!



[TOPIC: post.html]
#17

jaime159castillo

[GLOBAL: userInfoPane.html]
jaime159castillo
  • Observer

  • 18 posts
  • Corona SDK

So I made a release build and uploaded the apk to google and it says "upload failed, you signed with a certificate that is not yet valid, you need to sign with a certificate that is valid", can anyone help? I am trying to release it to google

[TOPIC: post.html]
#18

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,075 posts
  • Enterprise

Googling for this error tends to indicate that there is a time setting problem on your computer. There were three different scenarios that leads to this error:

 

1. Your time is off, ahead of when it really is.

2. Your timezone isn't set correctly.

3. You're in a timezone different than Google's servers and perhaps crossing a day boundary. 

 

When you created the keystore, one of the values inside it is when it's validity starts. If you're keystore is valid in the future due to one the three scenarios above, then Google may not accept the signed app.

 

There are two main suggestions on how to solve this.

 

1. Set your computer's date and time back a day or two. Remake the keystore. Set your clock back to the current date time and remake your .apk.

2. Wait a few hours and try again once your current computer date time is old enough to where the keystore has become valid.

 

Obviously the latter one is the least work but the least satisfying. 

 

Rob



[TOPIC: post.html]
#19

jaime159castillo

[GLOBAL: userInfoPane.html]
jaime159castillo
  • Observer

  • 18 posts
  • Corona SDK

Thanks again Rob!! :D  :rolleyes:  :)




[topic_controls]
[/topic_controls]