Packaging the Game

You must take care of several things before the game is completed and ready to publish. This section goes over how you clean the code and finally compile the product into an APK file that is ready for distribution. An APK is the packaging that contains all of the game code, images, and resources.

Follow these steps:

  1. The first order of business is to remove any Log.d statements in the code. I usually perform a global find and replace to delete them. You don’t want a retail version to waste processing power sending our debug warnings.
  2. You must fix the version of the code in the Android manifest file. Locate this file by going to the root of the HarborDefender folder and opening AndroidManifest.xml. The code should be similar the markup shown in Listing 10-4.

Listing 10-4. AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.gameproject.harbordefender"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="11" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".MainActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
</manifest>

Notice the bold portions. You can set your own version code and version name, but it’s customary, because this is your first game, to use 1.0 as the version. Also ensure that the minimum SDK version is 11.

3. Choose File > Export in Eclipse.

4. Select Export Android Application as the type of export you would like to perform.

5. On the next page, enter the name of your final project: Harbor Defender.

6. You must create a keystore, which is required to protect the security of your application and is used as an identifier by the Android app market. Select Create New Keystore as shown in Figure 10-3, and use the Browse button to open a window that lets you place the file in a folder.. Type the file name as something like harbordefenderkey, and accept the default location.

images

Figure 10-3. The prompt to generate a key

7. Create a unique and difficult password for your own protection, as shown in Figure 10-3.

8. Fill out the Key Creation page shown in Figure 10-4 with the applicable information. (The figure shows how I completed it.) The password can be the same as the one that you used on the previous page.

images

Figure 10-4. Filling out the developer information

9. The next page is the last. Click Browse, and type HarborDefender as the APK destination. Close the dialog box, and finish the process.

That’s it—you’ve finished the project. The next section handles how you get this project into the Application Market and into the hands of consumers. You also cover how to best market and work on your presence in the crowded app market.

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

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