How to prepare and submit paid application to Android Market? Checklist for programmers

We’ve got some emails from programmers asking for a brief checklist on how to build, debug and submit paid applications to Android Market with Eclipse and Android SDK. On the Android Developers web site we can find several excellent user guides and hints. Herewith we summarize what developers should do. We assume that you have downloaded all the plugins and SDKs. License Verification Library(LVL) package has been integrated into your app. The application is ready to be uploaded to the Android Market to be debugged, tested and published.
1. Open publisher account Here you can configure your shop as well as prepare, upload, and publish or update your apps. In the developer console configure your profile (see Edit profile):

1. Copy your Public Key into your application code as String object like this: private static final BASE64_PUBLIC_KEY=”+fi6EQ5…+hgNoKnz3Z”;

Where to copy? You will need it here.

2. Enter gmail addresses of the members of your test group into Test Accounts.

3. Set License Test Response to LICENSED. Later you can play with it.

Android Market Publisher Account

Android Market store

2. Customize License Verification Library

1. For the first time customize LVL source code. For details and sample source code read this post. Modify LicenseChecker() constructor and LicenseValidator.java:verify() methods to increase the complexity of your app (see com.android.vending.licensing).

2. Your application must be signed with a private key whose validity period ends after 22 October 2033. We use 100 years to be sure. Luckily Eclipse’s Export Wizard performs a GUI instead of running manual procedures to compile, sign, and align the code in a later step.

Application licensing overview

Obtain private key

Customize LVL.

3. Add your new application to Android Market Before debugging and testing your app, you should build the first draft version and upload it to your Android Market account (don’t worry, it’s a draft version):

1. Set version number in AndroidManifest.xml like android:versionCode=”1″ android:versionName=”1.0″. Don’t change them until the very first release update.

2. Set android:debuggable=”false” and look at package, icon, label, minSdkVersion etc. The manifest package= string must be unique and same during your app’s lifecycle, and looks like package=”com.grreeny.RandomFacts”.

3. Clean and build your app. Export your .apk package to a local folder. How: Eclipse -> File -> Export -> Android -> Export Android Application. The process will sign your code.

4. Login to your Android Market account. Add a new application. Upload icon files and .apk file.

5. Click on Save. Do not publish it!

Icon sizes and application configuration

Sample AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.program.my"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="8" />
    <application android:icon="@drawable/ic_app"
                android:label="@string/app_name"
                android:description="@string/app_desc"
                android:debuggable="false">
        <activity android:name="MyActivity"
                  android:label="@string/app_name"
                  android:screenOrientation="portrait"
                  android:theme="@android:style/Theme.Translucent.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    <!-- Required permission to check licensing. -->
    <uses-permission android:name="com.android.vending.CHECK_LICENSE"/>
</manifest>
4. Debug and test your application

To debug your code with active licensing, you must sign in with your Android Market or test account email address on the device or the emulator you use:

1. On the device or emulator open Settings -> Accounts & sync -> Select Add Account and choose to add a “Google” account. Select Next and then Sign in. You must sign in every time the emulator is rebooted. Without valid log in you will not receive “LICENSED” return code from the server.

2. In the emulator select Google APIs Add-On, API 8 or higher, and NOT a standard Android system image.

3. Don’t choose Android 2.3.3 emulators otherwise you will likely get an invalid license reply from Google’s server. It’s a know bug and brings an infamous log message up: Could not bind to service. You could hack the LVL source code, but WTF (using getApplicationContext().bindService instead of plain bindService solves some problems).

4. Do not call the licensing server too often or you’ll start getting 503 errors (hint: one call per minutes). It takes a while to reset.

Testing with emulators (AVD)

Testing with device

5. Submit your release version and publish it

When you are finished debugging and testing your implementation, you are ready to publish it. Upload the latest and tested release code to your Android Market account. Finalize information fields and set prices etc. At the end of a long process click on Publish.