Once compiled, an Android application is packaged as an APK file. The package contains binaries as well as resources. Android applications can be published to an app store such as Google Play or just directly installed on devices configured to install applications from unknown sources.
You can't publish an application to any app stores if the package isn't digitally signed. To sign the application, you must first obtain a certificate. The certificate will be used to identify you as the author of the application.
1. Get a certificate
The Java SDK provides a tool for generating and managing certificates a certificate. It is the keytool application and it is available in the Java SDK directory. For Android development, there's no need to buy a certificate from an authorized certificate authority; a certificate self-issued using keytool is more than acceptable for the purpose of publishing the application.
2. Sign the application
Once you hold the certificate you need to compile the application for release and sign the resulting executable. Also for signing, there's a Java SDK command-line tool: the jarsigner tool. This tool is often integrated in the IDE of choice; this is precisely the case with IntelliJ IDEA.
To start the wizard that signs an application, you click Build|Generate signed APK.
3. Get a certificate from IntelliJ IDEA
If you haven't created the certificate yet, you can do that from within the previous dialog box. You just click on Create new and get displayed the following dialog box.
4. Deploying the application
At the end of the wizard, you still have an APK file compiled for release and digitally signed. This is just the file to upload to the app store of choice or to pass around to install directly on enabled devices.