Signing Android Applications In 3 Easy Steps

I know this was suppose to be simple, but I can’t seem to get it to work.

I am on Windows 7 and building an app for Android. I do have the JDK installed. But I do not know how to link the keytool command to Corona.

I go around this problem by going to the comman prompt and changing the directory to where the keytool batch file lies (in my cases it is in some C:\Program Files\java…\bin). I than type in the keytool command as indicated in this post and everything seem to work. The difference are:
* It ask me for more details after the password, including my full name, organisation unit/name, city, state etc…
* When it came to generating the certificate it ended with a ‘Access is denied’ error.

Than, I could go no further. Any clues would be appreciated.

Kind Regards. [import]uid: 93204 topic_id: 8963 reply_id: 75960[/import]

Hello Ninjapig,

If you have our game and it’s up and running on the IOS devices will it be the same for android? Including Openfeint, etc… Because my game is currently running on IOS but not android, so will it be a hassle to change to android?

Thanks for your help! [import]uid: 23689 topic_id: 8963 reply_id: 76036[/import]

Sorry if I did not explain very thorough. [import]uid: 23689 topic_id: 8963 reply_id: 76038[/import]

@dhw688

You have to set up your path variables. There is a full tutorial here:
Video Tutorial: http://www.youtube.com/watch?v=extCL1UU5wk
Corona Reference Documents: http://developer.anscamobile.com/reference/installation-and-setup-windows

@MichaelAssadi

I have OpenFeint in my Android games and they work fine. I’m pretty sure that both iPhone and Android OpenFeint code is the same. Just make sure to make your OpenFeint app ID is the same as your Android application you made on the OpenFeint website.

Regards,
Jordan Schuetz
Ninja Pig Studios [import]uid: 29181 topic_id: 8963 reply_id: 76142[/import]

Thank you ninjapig123 for your links. They were indeed very helpful. My app is now in the market. Thanks.

Kind regards. [import]uid: 93204 topic_id: 8963 reply_id: 76276[/import]

@kam187,

Where do you show your ads? Do you have ads after each level, or during the game, or someplace else? [import]uid: 16734 topic_id: 8963 reply_id: 76640[/import]

If you look at the video i’ll explain. (The video is the paid version so doesn’t have ads)

http://www.youtube.com/watch?v=jpeHTRFM1_8

I have an admob banner ad 320x48, centered at the bottom of the screen. Its displayed on the main ‘walkabout’ title screen (where you see the blue play button). There’s no ad on the level selector or the loading screen, no when the princess pops up. Once the princess disappears I display the banner ad in the same place, bottom center again. It disappears at the end of the level.

I’m using my admob hack, and refreshing the ad ever 30 seconds. [import]uid: 8872 topic_id: 8963 reply_id: 76642[/import]

Thank you for laying out these three simple steps, the official android documentation is convoluted and difficult to read. It took me ages to find this forum post.

I think this information should be included on http://developer.anscamobile.com/content/building-devices-android. [import]uid: 62617 topic_id: 8963 reply_id: 85786[/import]

Thanks! I always had trouble signing my app! This post helped me a lot! [import]uid: 44110 topic_id: 8963 reply_id: 91154[/import]

Hi Jordan

If i have created an app for i-phone using my mac, can i simply create a file using carona for android. If so, how? [import]uid: 23812 topic_id: 8963 reply_id: 94783[/import]

You sign your application on Mac the same way as you sign it on Windows @wesamcharkawi [import]uid: 29181 topic_id: 8963 reply_id: 94891[/import]

Dude you’re a Godsend!! I was banging my head on how to do this for a little bit and I remembered there was this thread floating around out here with ALL the answers. Totally cool of you Ninja Pig!!

PS I heard you on the IndieGameDev podcast, that was a killer show! Glad you got some exposure!

-Mario [import]uid: 11636 topic_id: 8963 reply_id: 97229[/import]

Jorden,

Is there a step by step guide for mac users. For example, what to place in the main.lua if anything and the terminal window (which one are you referring to?).

[import]uid: 23812 topic_id: 8963 reply_id: 97240[/import]

[Solved] I did not need to install JDK. It’s already installed anyway. After reading more and felt exasperated, I thought, maybe, I should just try what I do when all fails – that is, rebooting my Mac. Who knows, it might just clear out whatever got screwed along the way. And OMG, it did. I gave it another shot at launching Terminal.app (from Applications > Utilities), and then followed step #10 from below, and this time, no error occurred. I am able to confirm I’ve got my keystore on my machine too (by searching for “.keystore” using Finder). Glad I didn’t just give up. Whew.


Ugh, I got keytool error: java.io.FileNotFoundException: mygame.keystore (Permission denied).

I use Mac, and here’s what I’ve done so far:

  1. Installed Android SDK Tools
  2. Installed Android SDK Platform-tools
  3. Installed some of Android 2.2 (API8):
    * SDK Platform
    * Samples for SDK (probably wasn’t necessary)
    * Nookcolor
    * Google APIs (probably wasn’t necessary)
    * GALAXY Tab
  4. Installed some of Android 2.3.3 (API 10):
    * SDK Platform
    * Samples for SDK (probably wasn’t necessary)
    * Nook Tablet
  5. Successfully installed & launched myGame.apk on Nook (and Kindle)
  6. Read through this thread (thank you, Ninja Pig and all the others) as well as other threads I found.
  7. Launched Terminal.app
  8. Typed:
    sudo keytool -genkey -v -keystore mygame.keystore -alias mygamealias -keyalg RSA -validity 999999
  9. Could not get past the password prompt.
  10. Tried this next:
    keytool -genkey -v -keystore mygame.keystore -alias mygamealias -keyalg RSA -keysize 2048 -validity 999999
  11. It asked me to enter keystore password, and then re-enter new password
  12. With a great sense of relief, I answered whole list of questions, including my name, my organization, my location.
  13. It finally spat out the list of my answers and asked if it’s correct.
  14. I typed yes and hit enter
  15. It asked for key password for mygamealias (and told me to RETURN if same as keystore password), so I simply hit enter.
  16. Then it began storing mygame.keystore – then came the error:

java.io.FileNotFoundException: mygame.keystore (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:194)
at java.io.FileOutputStream.(FileOutputStream.java:84)
at sun.security.tools.KeyTool.doCommands(KeyTool.java:902)
at sun.security.tools.KeyTool.run(KeyTool.java:172)
at sun.security.tools.KeyTool.main(KeyTool.java:166)

What do I do now? Do I need to install JDK before this error goes away?

Naomi
[import]uid: 67217 topic_id: 8963 reply_id: 99143[/import]

This post is a great one. [import]uid: 23812 topic_id: 8963 reply_id: 99477[/import]

Very useful! Thanks for this!! [import]uid: 14018 topic_id: 8963 reply_id: 101542[/import]

Hi,
I still can’t figure this out. I followed your instructions, but don’t quite understand what happens next. I know I successfully created the signature, because I just tried to do it again and got this message:
keytool error: java.lang.Exception: Key pair not generated, alias already exists
java.lang.Exception: Key pair not generated, alias already exists
at sun.security.tools.KeyTool.doGenKeyPair(KeyTool.java:1129)
at sun.security.tools.KeyTool.doCommands(KeyTool.java:786)
at sun.security.tools.KeyTool.run(KeyTool.java:172)
at sun.security.tools.KeyTool.main(KeyTool.java:166)

But now that it is created, how do I make it show up in Corona when I do the android build. It is still only giving me one option… android debug.

I’m on a MAC using Lion.
Thanks! [import]uid: 106593 topic_id: 8963 reply_id: 105225[/import]

@lwat4ever
What ever you named your keystore, just click browse, then search that name on your computer. It will be on your Mac HD hard drive, then Users, Name, android-sdks.

Regards,
Jordan Schuetz
Ninja Pig Studios [import]uid: 29181 topic_id: 8963 reply_id: 105231[/import]

@Ninja Pig Studios
I do have a problem it harass me so much!!
i have signed android apk by debugkey and realkey.

i don’t see why i run the app on real device(android)
Sometimes it’s text disappear.
just like a “display.newRect()”
color is whole black…
sometimes i move it and the text come back again become normal.
sometimes it disappear again…

I have tried set
“android.permission.INTERNET”,
“android.permission.ACCESS_FINE_LOCATION”,

but in vain

I’m using Corona version 806(tried 704,7XX)
am i wrong somewhere?
or something i have forgotten to set? [import]uid: 25057 topic_id: 8963 reply_id: 105234[/import]

@coolseal

It seems like everything you did in the build process is correct. If the app runs on the device, then you did everything correct. Looks like your problem lyes in your coding, you should probably check when you are removing display objects etc. Also try using a recommended build and see if that helps.

Regards,
Jordan Schuetz
Ninja Pig Studios [import]uid: 29181 topic_id: 8963 reply_id: 105239[/import]