Signing Android Applications In 3 Easy Steps

Anyone from CoronaLabs staff have some comments on my problem? Keystore works great in Eclipse and I’m signing my applications with it, but it won’t open in Corona (says wrong password). Debug keystore from Corona also requires password and won’t open (which is wierd). Windows 7 64 bit. Anyone?

Otherwise I can’t use Corona for my projects… :frowning:

Problems with the Android keystore points to problems with the JDK. Corona uses a JDK command line tool to access the keystore. The only suggestion we have is to uninstall and then reinstall JDK6 on your computer.

For signing problems, the only known issue that we have is if the PATH environment variable is set to one of the other JDK’s, then the final build step will use the wrong JDK version to sign the APK, causing it to be digitally signed wrong and prevent the app from being installed on an Android device… because Android only supports the 32-bit JDK 6.  Oracle/Sun does not set the PATH environment variable when installing the JDK, but I suspect that some 3rd party Java tools do, causing this issue to come up every once in a while.

Go back and read the information in this forum thread. It contains lots of useful information for resolving keystore issues. 

I also get the incorrect password in Mac OSX Lion.

My command is this

keytool -genkey -v -keystore myappname.keystore -alias myappname -keyalg RSA -validity 999999

Tried with and without sudo and same error, when I select the keystore and the alias when building in Corona SDK 1059 I get that file is corrupt or password incorrect

This should be all documented, guys please make it easy for us all to publish our amazing apps, this is nowhere to be found in the docs, how are we supposed to find out how to do it?

Hi @guriek, we have it documented in our Android building guide:

http://docs.coronalabs.com/guide/distribution/androidBuild/index.html

but you have the command as listed in there, so it seems you’ve read it.  Keep in mind, if you do the command as:

sudo keytool -genkey -v -keystore myappname.keystore -alias myappname -keyalg RSA -validity 999999

 

it’s going to prompt you for your Mac’s login password first.  Then it will run the command for you.  Here is the dialog from where I just created one.  Of course you need to change the values accordingly:

mymacbook:~ rmiracle$ sudo keytool -genkey -v -keystore myappname.keystore -alias myappname -keyalg RSA -validity 999999 Password:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \<------- my Mac's login password Enter keystore password: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \<------- made up password for the keystore Re-enter new password:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \<------ made up password for the keystore a 2nd time 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; Palo Alto&nbsp;&nbsp; &nbsp; What is the name of your State or Province? &nbsp; [Unknown]:&nbsp; CA 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=Palo Alto, ST=CA, C=US correct? &nbsp; [no]:&nbsp; yes Generating 1,024 bit RSA key pair and self-signed certificate (SHA1withRSA) with a validity of 999,999 days &nbsp;&nbsp; &nbsp;for: CN=Rob Miracle, OU=Developer Relations, O=Corona Labs, L=Palo Alto, ST=CA, C=US Enter key password for \<myappname\>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \<------------- just hit the ENTER key to use the password above &nbsp;&nbsp; &nbsp;(RETURN if same as keystore password): &nbsp; [Storing myappname.keystore]

This will dump the file into the folder where you ran the command.  I went to build with 1150 and it prompted me twice for my keystore password, then finally I had to hit the build button after entering the password a 2nd time, but it worked.

I have done exactly that and the command line accepts the passwords for both the keystore and the key alias, yet Corona cannot build, saying the key alias is invalid. I have deleted the key and regenerated it a couple of times, still getting the same results.

Error message: jarsigner error: java.lang.RuntimeException: keystore load: Keystore was tampered with, or password was incorrect

I am running Corona Version 2013.1128 (2013.5.28) on Mac OS X Lion.

Should I be upgrading my Android simulator or any such thing?

Cheers,

Ziad.

Sorry, please disregard my query. I regenerated the keystore one more time with a simpler password (no punctuation marks) and it seems to have done the trick! 

I’ve been trying several ways to get this fixed but I am unable.

I can create the keystore properly but I get “The password for the key alias **** was not valid” all the time, even though the password is correct.

I am running a Mac OS X 10.7.5 and Java 7, I’ve read in several places that I need to run with Java 6 to make this work but I can’t find anywhere instructions on how to get it fixed when the system has already java 7 installed (in my case automatically updated).

Tried to download java 6 from oracle but can’t find the Mac version available.

Can anybody help me?

Ok disregard my previous message, I managed to find out what I was doing wrong.

I opened the key manager, searched for “corona” and watched what the keystore command was doing, and found out that I was getting confused with so many passwords, entering the password for my key manager (which has special characters) twice. Now using simple password for the keystore it finally worked.

Thank you for all the help and apologies for the previous message.

This just will not work for me :frowning:

EDIT: Solved, turns out it just needed switching off and on again… typical I.T…

However now I’ve got that working, do I need to specify the same path when building for release where it says keystore?

M

Can you do a search:  hit your start button and type “keytool” into the search box that pops up and see if you can find it?  If you don’t have it, your JDK may not be installed correctly.

Hi Rob, thanks for your reply!

I’ve got it all working, keytool, jarsigner and zipalign! Took a bit of trial and error but now I’m a little wiser! Thank you!

M

In fact! Check it out! -> https://play.google.com/store/apps/details?id=come.acme.games.prankster&hl=en

Would love anyone to give me a couple of reviews! 

There is a Facebook group of Corona Indie developers who review each other’s apps in exchange for you reviewing their apps.  Free for Free, paid for paid.  You might be interested in asking for reviews there and participating.

https://www.facebook.com/groups/310088005728833/527851537285811/?notif_t=group_activity

Thanks Rob! I’ve never heard of it before.  I’m going to join  :slight_smile:

This is my first time making an app for Android and my client is requesting unsigned apk. 

I have Pro version and I have no idea how to generate an unsigned apk.

it’s not really EASY!! yow windows noobs like me who’s having problems. hit me up if u have problems. i’ve managed to overcome this programming hurdle. . command prompts doesnt recognize the keywoord ‘keytool’ , u need to do that inside the ‘bin’ directory of java (:

and make sure you have “SSL” installed. if you dont, download it for Gs sake!

Very good…

This is the easy steps fr android app

I can’t type anything when it asks for password :\ any suggestions?

I imagine it is still receiving the input, just not showing it visually for security reasons.

Try entering your password and pressing enter.

Yup, works just fine, thank you! :slight_smile: