Uploading Apps to Google Play. Basic Guide (Android SDK)

After posting the Signing & uploading App guide for Marmalade SDK, we will now go with the Android one. Again, i’m getting the Android app signing tutorial as the basis. First of all, we have to generate the .keystore file. We will just reproduce the steps made in the the Marmalade tutorial:

1.- Generating a new .keystore file

We are going to to generate it using keytool.
keytool comes with the Java Development Kit (jdk) and can be called from command line, writing:

keytool

keytool has to be supplied with some arguments. There are more details here, but the basic usage should fit for us:

keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000

we just need to change the default .keystore file name and the alias_name by our own names.
Increasing the validity could also be a good idea, to make the keystore file valid for a longer period.

As an example: Let’s say we are requesting a keystore file for “John, the developer”:

keytool -genkey -v -keystore johnthedeveloper.keystore -alias johnDev -keyalg RSA -keysize 2048 -validity 30000

keytool will now request some additional data we have to fill, like our name, organisation unit, organisation name, city, state, and locale code.

Name: John the developer
Organisation unit: Development
Organisation name: John dev S.R.L.
City: Los santos
State: Liberty city
Locale code: 23456

once done, we have our .keystore file ready to go.

2.- Generating a signed .apk file (the easy way)

Once the .keystore file is created, all that we need is to compile our App’s .apk file signed with our private key (.keystore file). The easiest way to do this is using ant, including our keystore information into the ant.properties file, located in our Android project’s root directory. So, into the ant.properties file, add these 2 lines: key.store=key-file.keystore key.alias=keyalias the first one is the name (and optionally, the path) of the .keystore file. The second one, is the -alias parameter supplied to keytool, when we generated the .keystore file. Don’t forget to have your “key-file.keystore” file located into the project’s root directory! Once these 2 lines are added, we can run again: $ant release and we will be prompted for two passwords:

  • The keystore password (store: key-file.keystore)
  • The password for alias ‘keyalias’

After writing those two passwords (we supplied them to keytool when we generated the .keystore file), ant should return BUILD SUCCESSFUL, and we have our <AppName>-release.apk file into the bin/ directory. This APK is ready to be uploaded to Google Play! Have fun!

2b.- Generating a signed APK (the even easier way, for Eclipse users)

Another way of generating the signed .APK is using Eclipse, right clicking on the project name in the Package Explorer, and selecting Android Tools > Export Signed Application Package. On the first menu, click “Next”, then on the second one, select “Use existing keystore”. Click on “Browse” and double click on the .keystore file. Now write the keystore password, and click “Next”. Finally, select “Use existing key” and select the key alias found in the “Alias” field. Write down the password for that key alias, then Click “Next”. Select the destionation .apk file and click “Finish” 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s