Publishing in the Android market

Before you can publish your app/game in Google's Android market, you need to do some homework, first. Here is a list of things you need to do:

  • Create the app icons
  • Change the app label and package name
  • Set the version code and name
  • Rename the app package
  • Remove the debug key from the package
  • Create a private key to sign the app
  • Sign the package with your new private key
  • Zipalign your app package

Let's go through each task one by one.

Create app icons

The good thing is that we have learned about this before in Chapter 5, Game #4, Chain Reaction. If you've forgotten about it, then just take your time to read it up again.

Change the app label and the package name

Again, this is something we have done together at the end of Chapter 5, Game #4, Chain Reaction. If you are not familiar with it, have a look there again.

Setting the version code and name

Inside the android/templates/AndroidManifest.xml file, there are two lines that you need to change, once you work on updates of your app:

android:versionCode="1"
android:versionName="1.0"

The versionCode value is just an integer that should be raised by one with every version you release. It actually will indicate if your user will become notified that there is an update for your app. So, don't forget to raise this number each time you create the final build of your next app version. versionName is information the user can see on the device and maybe in the market too.

Rename the app package

When you build the app, the name of the package is always set to monkeygame-debug.apk. The file is located inside the android/bin/ folder. Just rename it to your liking, say something like awesomegame.apk or myfirsthitgame.apk. Of course, a more meaningful app name would be better.

Remove the debug key from the package

Every time you build your app through Monk, the resulting .apk file is signed with the default debug key, even when you create a release build. You need to delete it from the package, so that you can resign it. For this, you need a tool such as WinRAR. Open the .apk file with it (do not extract it) and remove the META-INF folder. That is the place where the debug key is stored.

Create a private key to sign the app with

To create a new private key for your app, please read up Google's instructions at http://developer.android.com/guide/publishing/app-signing.html, first.

To create a new keystore for you app, just open your terminal (OSX) or your console (Windows) and type the following command:

keytool -genkey -v -keystore yourKeystoreName.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000

It will start the keytool utility, where you have to answer a few questions. If you set a password, make sure that you remember it!

Sign the package with your new private key

Next, sign the .apk package with your new private key. While still in the console or terminal, type in the following command:

jarsigner -verbose -keystore yourKeystoreName.keystore
my_application.apk alias_name

Depending on your folder names, you might have to use the whole path of your keystore in it.

Zipalign your app package

To make sure that your package it properly aligned, bitwise, you need to run Zipalign on it.

For this, type the following command inside your terminal or console:

"/pathToYourAndroidSDK/tools/zipalign" -v 4
"pathToYourAPK/my_application.apk"
"pathToYourAPK/my_application_final.apk"

Now, you have a signed and align package file that you could upload to the Android Market. All you need now is a Google developer account, and then you can upload your app there.

To sign up there, go to http://developer.android.com/index.html and click on the Publish button. It is very easy to publish your app there, and you will figure it out in no time.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.209.180