Submitting Your App to the Android Market

Finally, the moment you’ve been waiting for: submitting your completed app to the Android Market. The process is actually pretty straight forward: you just need to prepare a release version of the app and upload it.

Preparing a Release Version of Your App

You need to do a few things to get the app ready for distribution:

  • Remove any debugging or logging code
  • Version the app
  • Compile the app
  • Sign the compiled app with a private key

Removing Debug Code

There’s no reason to have debugging or logging code.  Those slow down your app while it’s running on a user’s phone.  You should open up the AndroidManifest.xml file in the KiloGap folder, search for “debuggable” and set it to false. When you are done, it should look something like this:

<application

android:icon=”@drawable/icon”

android:label=”@string/app_name”

android:debuggable=”false”>

Versioning Your App

Near the top of your AndroidManifest.xml file, you should see values set for the version name and version code for your app:

<manifest

xmlns:android=”http://schemas.android.com/apk/res/android”

package=”com.jonathanstark.kilo”

android:versionName=”1.0.0″

android:versionCode=”1″>

If this is probably your first app, these values are fine as is. Once you’ve published your app and later want to release an update, you’ll change these values appropriately. The Android system doesn’t      check or enforce this version information, but it’s a critical piece of data for your long term app strategy.

The version name is the value that will be shown to the user. It’s a string, so you can put whatever you want here, but the common practice is to use a <major>.<minor>.<point> format (such as 1.0.0).

The version code is expected to be a positive integer value. It need not correspond to the version name in any way. In fact, it probably won’t—you should just increment it by 1 every time you release an update, regardless of whether the release is a major upgrade or a minor bug fix.

Signing Your App

Android requires that all apps be digitally signed by the developer. The process for doing so is easy, but a little cryptic.

1) Launch the Terminal application and navigate into the KiloGap directory:

cd ~/Desktop/KiloGap

2) Compile the app in release mode:

ant release

You’ll see a page or so of output scroll by, ending with BUILD SUCCESSFUL. An unsigned binary named Kilo-unsigned.apk will now be sitting in the ~/Desktop/KiloGap/bin/ directory

     

    3) Create a private key:

    keytool -genkey -v -keystore keystore -alias alias -keyalg RSA -validity days

    This command is interactive and will ask you a bunch of questions. Mine looks like this:

    JSC-MBP:KiloGap jstark$ keytool -genkey -v -keystore myAndroidKey.keystore \

    -alias myAndroidKeyAlias -keyalg RSA -validity 10000
    Enter keystore password:
    Re-enter new password:
    What is your first and last name?
    [Unknown]: John Doe
    What is the name of your organizational unit?
    [Unknown]:
    What is the name of your organization?
    [Unknown]: Jonathan Stark Consulting
    What is the name of your City or Locality?
    [Unknown]: Cupertino
    What is the name of your State or Province?
    [Unknown]: CA
    What is the two-letter country code for this unit?
    [Unknown]: US
    Is CN=John Doe, OU=Unknown, O=Jonathan Stark Consulting, L=Cupertino, ST=CA, C=US correct?
    [no]: yes
    Generating 1,024 bit RSA key pair and self-signed certificate (SHA1withRSA) with a validity of 10,000 days for: CN=John Doe, OU=Unknown, O=Jonathan Stark Consulting, L=Cupertino, ST=CA, C=US
    Enter key password for <myAndroidKeyAlias>
    (RETURN if same as keystore password):
    [Storing myAndroidKey.keystore]
    When the process completes, you should see myAndroidKey.keystore created in the ~/Desktop/KiloGap directory. If you’d like to use this keystore for other apps in the future, you might want to move the keystore file to a more central location. 

    4) Sign your app with the key you just created:

    jarsigner -verbose -keystore myAndroidKey.keystore

    ./bin/Kilo-unsigned.apk myAndroidKeyAlias

    When you run this command, you’ll be asked for your keystore password.

    5) Align the .apk file:

    zipalign -v 4 ./bin/Kilo-unsigned.apk ./bin/Kilo.apk

    You’ll see a page or so of output scroll by, ending with “Verification successful.” A signed binary named Kilo.apk will now be sitting in the ~/Desktop/KiloGap/bin/ directory. This .apk file is your completed app!

    Uploading Your App to the Android Market

    All that is left to do is upload our signed binary to the Android Market.

    1. Launch your web browser, navigate to http://market.android.com/publish/, and sign in to your Google account.

    2. If you aren’t forwarded automatically after logging in, navigate to http://market.android.com/publish/Home and click the Upload Application button

    3. Click the Choose File button next to “Application .apk file,” browse to Kilo.apk on your hard drive, and click the Upload button.
    4. You can optionally upload a couple of screenshots to be displayed on the Market page for your app.
    5. Enter a title for your app in the Listing Details section (30 characters max).
    6. Enter a description for your app (325 characters max).
    7. Select a type and category for your app.
    8. Specify a price for your app.
    9. Indicate your copy protection and location preferences in the Publishing Options section.
    10. Enter your website address, email address, and phone number in the Contact Information section.
    11. Agree to the terms in the Consent section.
    12. Click the Publish button.
    Congrats! Your app will be available in the Android Market almost immediately. 

    Distributing Your App Directly

    One very attractive feature of the Android platform is that it lets developers skip the Android Market completely and distribute apps directly to users. This is a great option in many situations. For example, a corporate IT department might want to distribute a private app to employees. Or maybe you want to run a private beta of your app before uploading it to the Android Market.

    Whatever the case, direct distribution couldn’t be easier: upload your signed .apk binary to your web server and provide your users with a link to it. Users click the link— say, from an email message or a web page—and the app is downloaded and installed. Simple.

    The only caveat is that users have to first allow installation of non-Market applications by navigating to Settings→Applications and enabling the Unknown Sources option. If the user has not first enabled downloads from unknown sources, the user will still be allowed to download the app, but will be alerted that the install is blocked. The alert dialog will allow him to navigate directly to the relevant setting or cancel the installation. When the user first activates the checkbox, they will see a confirmation dialog that warns them about the implications of their choice.

     

Leave a Reply