-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Publishing to the Play Store
- Remove Log method calls
- Digitally sign and export the app
- Sign up for a Publisher Account on Google Play
- Upload APK and enter application details
To avoid deleting all the log calls manually, Android Studio provides tools to do so easily. By configuring Proguard, statements to strip calls to any of the Log methods can be added.
Firstly, Proguard needs to be enabled in the module's build.gradle
file. Also, change the standard default proguard settings file to proguard-android-optimize.txt
, which is better suited for optimizing the apk file.
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Next, add the following lines to the proguard-rules.pro
file:
-assumenosideeffects class android.util.Log {
public static boolean isLoggable(java.lang.String, int);
public static int v(...);
public static int i(...);
public static int w(...);
public static int d(...);
public static int e(...);
}
This option for Proguard is only applicable when optimizing and will remove all the listed methods.
Note: It is possible to publish an app without this step, but it's highly recommended to do it for performance reasons.
Note: When logging sensitive information, it is needed to use another method to remove the strings that are actually logged in the log methods.
Digitally signing and exporting is easier than it sounds, using the wizard built into Android Studio.
To make use of it, click Generate Signed APK under Build menu.
Select the module that has the app code, if prompted to do so.
Create a new key store if first time. Else, skip.
The key store holds the private digital key needed to sign the application. Store it in a common location, for further use.
Provide an Alias for the key in the key store and enter its validity in number of years.
Fill in at least one field of the certificate's organizational details.
Pick desired key from key store or create a new one.
Finally, pick the folder in which the apk file will be saved. Make sure the Build Type is set to release.
Note: Same key store is needed to sign updates for the same app. Note: For different apps a new keystore could be generated every time, but the recommended approach is to generate one key store per developer/organization and then sign all apps with the same key store. Note: Remember your password and the keystore location.
Here you can find a useful checklist of all the steps required to sign up for a publisher account.
At the same page you can also find instructions on Setting Up a Google Wallet Merchant Account, if there's the case of selling apps, providing in app purchases or subscriptions.
- Go to Google Play Developer Console which enables developers to easily publish and distribute their applications.
- Enter basic information about your developer identity.
- Read and accept the Developer Distribution Agreement for your country or region.
- Pay the $25 USD registration fee.
- Confirm verification by e-mail.
This is the place to manage the (un)published apps. There is the possibility to get everything ready in a draft status before actually publishing the application.
This is another very important checklist to help understand the publishing process and determine which steps were left out.
See Automating Publishing to the Play Store for an advanced tutorial about streamlining the process for pushing your updates.
Created by CodePath with much help from the community. Contributed content licensed under cc-wiki with attribution required. You are free to remix and reuse, as long as you attribute and use a similar license.
Finding these guides helpful?
We need help from the broader community to improve these guides, add new topics and keep the topics up-to-date. See our contribution guidelines here and our topic issues list for great ways to help out.
Check these same guides through our standalone viewer for a better browsing experience and an improved search. Follow us on twitter @codepath for access to more useful Android development resources.