Changes

Signing and Preparing an Android 6 Application for Release

18 bytes removed, 07:53, 28 January 2016
m
Text replacement - "<google>BUY_ANDROID_STUDIO6</google>" to "<htmlet>androidstudio_a6</htmlet>"
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>
While each of these tasks can be performed outside of the Android Studio environment, the procedures can more easily be performed using the Android Studio build mechanism as outlined in the remainder of this chapter.
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>
== Changing the Build Variant ==
<google>ADSDAQBOX_FLOW</google>
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 62 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.
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>
The New Key Store dialog is now divided into two sections. The top section relates to the keystore file. In this section, enter a strong password with which to protect the keystore file into both the Password and Confirm fields. The lower section of the dialog relates to the release key that will be stored in the key store file.
Figure 62-6
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>
Assuming that the settings are correct, click on the Next button to proceed to the APK generation screen (Figure 62-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 and click Finish.
You need to use a different version code for your APK because you already have one with version code 1.
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>
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 62-9. It is important to note that this is not the top level build.gradle file positioned lower in the project hierarchy listing:
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>