Signing your application

The last step before we upload the release to the Google Play store is to generate a signed APK. Open your project and choose Build | Generate Signed APK:

Choose the main application module and continue by clicking on Next:

Since we don't have the key store yet, we will create a new one. Click on Create new... as follows:

Populate the data and click on OK. Click on Next and enter your master password if asked. Check both signatures and choose the complete flavor to build. Click on Finish:

Wait until the build is ready. We will also update our build.gradle so the build is signed each time we build a release:

    ... 
    android { 
      signingConfigs { 
        release { 
          storeFile file("Releasing/keystore.jks") 
          storePassword "1234567" 
          keyAlias "key0" 
          keyPassword "1234567" 
        } 
      } 
      release { 
        debuggable false 
        minifyEnabled false 
        signingConfig signingConfigs.release 
        proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro' } } ...

If it's easier for you, you can run the build process from the terminal as follows:

$ ./gradlew clean 
$ ./gradlew assembleCompleteRelease 

In this example, we assembled the release build for the Complete application flavor.