Before you do the final compile of your application

5. Version your application

Before you compile your application, you must make sure that you have defined a version number for your application, specifying an appropriate value for both the android:versionCode and android:versionName attributes of the <manifest> element in the application's manifest file. Carefully consider your version numbering plans in the context of your overall application upgrade strategy.

If you have previously released a version of your application, you must make sure to increment the version number of the current application. You must increment both the android:versionCode and android:versionName attributes of the <manifest> element in the application's manifest file, using appropriate values.

For detailed information about how to define version information for your application, see Versioning Your Applications.

6. Obtain a suitable cryptographic key

If you have read and followed all of the preparation steps up to this point, your application is compiled and ready for signing. Inside the .apk, the application is properly versioned, and you've cleaned out extra files and private data, as described above.

Before you sign your application, you need to make sure that you have a suitable private key. For complete information about how to obtain (or generate) a private key, see Obtaining a Suitable Private Key.

Once you have obtained (or generated) a suitable private key, you will use it to:

• Register for a Maps API Key (see below), if your application uses MapView elements.

• Sign your application for release, later in the preparation process

7. Register for a Maps API Key, if your application is using MapView elements

If your application uses one or more Mapview elements, you will need to register your application with the Google Maps service and obtain a Maps API Key, before your MapView(s) will be able to retrieve data from Google Maps. To do so, you supply an MD5 fingerprint of your signer certificate to the Maps service.

During development, you can get a temporary Maps API Key by registering the debug key generated by the SDK tools. However, before publishing your application, you must register for a new Maps API Key that is based on your private key.

If your application uses MapView elements, the important points to understand are:

1. You must obtain the Maps API Key before you compile your application for release, because you must add the Key to a special attribute in each MapView element — android:apiKey — in your application's layout files. If you are instantiating MapView objects directly from code, you must pass the Maps API Key as a parameter in the constructor.

2. The Maps API Key referenced by your application's MapView elements must be registered (in Google Maps) to the certificate used to sign the application. This is particularly important when publishing your application — your MapView elements must reference a Key that is registered to the release certificate that you will use to sign your application.

3. If you previously got a temporary Maps API Key by registering the debug certificate generated by the SDK tools, you must remember to obtain a new Maps API Key by registering your release certificate. You must then remember to change the MapView elements to reference the new Key, rather than the Key associated with the debug certificate. If you do not do so, your MapView elements will not have permission to download Maps data.

4. If you change the private key that you will use to sign your application, you must remember to obtain a new Maps API Key from the Google Maps service. If you do not get a new Maps API Key and apply it to all MapView elements, any MapView elements referencing the old Key will not have permission to download Maps data.

For more information about signing and your private key, see Signing Your Applications.

0 0

Post a comment