34,333
edits
Changes
no edit summary
Once the development work on an Android application is complete and it has been tested on a wide range of Android devices, the next step is to prepare the application for submission to the Google Play App Store. Before submission can take place, however, the application must be packaged for release and signed with a private key. This chapter will work through the steps involved in obtaining a private key and preparing the application package for release.
== The The Release Preparation Process ==
Up until this point in the book, we have been building application projects in a mode suitable for testing and debugging. Building an application package for release to customers via the Google Play store, on the other hand, requires that some additional steps be taken. The first requirement is that the application be compiled in release mode instead of debug mode. Secondly, the application must be signed with a private key that uniquely identifies you as the application’s developer. Finally, the application package must be aligned. This is simply a process by which some data files in the application package are formatted with a certain byte alignment to improve performance.

[[File:as3.0_google_play_complete_listing.png]]

[[File:as3.0_play_store_manage_beta.png]]

[[File:as3.0_google_play_enroll.png]]

[[File:as3.0_build_variants.png]]

[[File:as3.0_build_variants_release.png]]

[[File:as3.0_generate_apk.png]]

[[File:as3.0_build_keystore_selection.png]]

[[File:as3.0_build_keystore_new.png]]

[[File:as3.0_build_keystore_new_complete.png]]

[[File:as3.0_build_keystore_generated.png]]

[[File:as3.0_build_generate_apk.png]]

[[File:as3.0_build_apk_generated.png]]

[[File:as3.0_play_store_manage_production.png]]

[[File:as3.0_upload_apk.png]]

[[File:as3.0_google_play_manage_testing.png]]

[[File:as3.0_apk_instant_app_upload_type.png]]

[[File:as3.0_upload_apk_testers.png]]
</pre>
To resolve this problem, the version code embedded into the APK file needs to be increased. This is performed in the module level build.gradle file of the project, shown highlighted in Figure 87-18: [[File:]] . By default, this file will typically read as follows:
<pre>

[[File:as3.0_build_analyze_apk.png]]

[[File:as3.0_build_analyze_dex.png]]

[[File:as3.0_app_signing_scren.png]]