Changes

Jump to: navigation, search

Generating a Signed Release APK File in Android Studio

No change in size, 18:03, 18 July 2014
no edit summary
== Changing the Build Variant ==
The first step in the process of generating a signed application APK file involves changing the build variant for the project from debug to release. This is achieved using the Build Variants tool window which can be accessed from the tool window quick access menu (located in the bottom left hand corner of the Android Studio main window as shown in Figure 5254-1).
[[Image:android_studio_build_variants_menu.png|Launching the Build Variants tool window in Android Studio]]
Figure 5254-1
[[Image:android_studio_set_build_variant.png|Configuring Build Variants within Android Studio]]
Figure 5254-2
== Creating a Keystore File ==
To create a keystore file, select the Build -> Generate Signed APK… menu option to display the Generate Signed APK Wizard dialog as shown in Figure 5254-3:
[[Image:android_studio_apk_build_keystore.png|The Android Studio Generate Signed APK Wizard dialog]]
Figure 5254-3
In the event that you have an existing release keystore file, click on the Choose existing… button and navigate to and select the file. In the event that you have yet to create a keystore file, click on the Create new… button to display the New Key Store dialog (Figure 52 54-4). Click on the button to the right of the Key store path field and navigate to a suitable location on your file system, enter a name for the keystore file (for example release.keystore.jks) and click on the OK button.
[[Image:android_studio_configure_release_key.png|Configuring private signing key information in Android Studio]]
Figure 5254-4
[[Image:android_studio_release_key_configured.png|Configuring private signing key information in Android Studio]]
Figure 5254-5
[[Image:android_studio_apk_generation_wizard.png|Keystore file and key information configured in Android Studio]]
Figure 5254-6
Assuming that the settings are correct, click on the Next button to proceed to the APK generation screen (Figure 52 54-7). Within this screen, review the Destination APK path: setting to verify that the location into which the APK file will be generated is acceptable. In the event that another location is preferred, click on the button to the right of the text field and navigate to the desired file system location.
[[Image:android_studio_generating_apk_file.png|Generating a signed APK file in Android Studio]]
Figure 5254-7
[[Image:android_studio_apk_built.png|Android Studio signed APK file generated]]
Figure 5254-8
</pre>
To resolve this problem, the version code embedded into the APK needs to be increased. This is performed in the module level build.gradle file of the project, shown highlighted in Figure 5254-9. It is important to note that this is not the top level build.gradle file positioned lower in the project hierarchy listing:
[[Image:android_studio_root_gradle_file.png|Selecting the module level build.grade file in Android Studio]]
Figure 5254-9

Navigation menu