Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

Releasing to the Android Market

Mononofu edited this page Aug 20, 2012 · 4 revisions

#Releasing to the Android Market#

##Generate a key##

First of all, you need to sign your app. For this, you will need a private key. You can generate one using the keytool program which is supplied with the JDK, as follows:

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

This will save a .keystore file in your home directory, which contains all kinds of super-secret private key stuff. Make a secure copy of this somewhere, because you'll need it throughout your Android career!

Note that SBT will assume that the file is called ~/.keystore. If you decide to name it differently, SBT will not be able to sign your app!

Also, remember the alias that you choose on the command-line. You'll need it in the next section.

For more information about keys and signing, see the Android Developers site.

##Update your build script##

Next, you have to update your build script, which is located in project/build.scala. Find the line:

keyalias in Android := "change-me",

and change it into

keyalias in Android := "alias_name",

If you used a different alias_name when generating the keystore, modify this line accordingly. If you still have an open SBT session at this point: exit and restart, because it doesn't refresh your new build settings automatically.

##Prepare your release##

In SBT's interactive prompt, run the following commands:

android:package-release -- this will generate an unsigned, release-mode APK file.
android:prepare-market -- this will generate a signed APK file, based on the one that was just generated.

Note: your password will be displayed in plain text on your screen, so don't do this in a crowded room or anything. (If prepare-market fails with "sign-release: Nonzero exit value", try an alias without a '-')

In the text that android:prepare-market outputs to the console, you will see the path to the APK file that you can upload to the Android market. It's in the target/ folder and it ends with -market.apk.

##Release your release##

Now that you have a properly signed APK file, you can release your app. Go to Android Developer Console and follow the instructions from there.

You will be asked to upload your APK file, and also to write a description, upload some screenshots (at least 2), and upload some graphics to display in the Market, so make sure you have these handy!

Once the app is uploaded, it's available (almost) immediately, although it might take a while until it finally shows up in the search. If you're impatient, you can access it directly using the following url: https://market.android.com/details?id=<package_name> where <package_name> is the Java package name for your app.

And that's it! You are now able to publish your app in the Android Market!

##Updating your app##

So, your app has been on the Market for some time, and you're ready to release version 2. Awesome! Here's how you do it.

  • Write version 2, obviously.
  • Next, you should enable automatic Android Manifest generation if you haven't done so already.
  • Bump the version and versionCode settings. Remember that versionCode is for internal use only and must increase by at least one, each time you release. version is the number that users may see, and could even remain the same (although I don't recommend that).
  • Then, re-build and sign your app as described above, and upload it!

 

 

Disclaimer: text copied with permission from here