Generating a signed APK

Starting with version 2020.3.1 of Android Studio, you can no longer generate a signed APK for the Clover App Market using the tools provided by the IDE. Instead, you can use Gradle and the Android Gradle Plugin to generate your APKs.

Configuring a Gradle build for APK generation

The following section provides setup instructions for a basic release build, but there many additional options you may need or want for your app.

📘

NOTE

Keeping keystore credentials secure is vital to ensuring the APKs uploaded to Clover are actually signed by the app developer. As noted in the Gradle documentation, you should externalize and encrypt any passwords and never include them in any build files under version control.

  1. Open the global gradle.properties file.

  2. Add the following properties and enter your value for each:

    keystore_file= // location and name of the keystore 
    keystore_password= // password for the keystore
    key_alias= // name of the key entry to be used for signing
    key_password= // password for the signing key
    
  3. Save and close the properties file.

  4. Open the module's build.gradle file.

  5. In the android block, add the following block to hold your APK signing configuration:

    signingConfigs {
      release {
    
      }
    }
    
  6. In the signingConfigs.release block, add the following properties:

    storeFile file(keystore_file)
    storePassword keystore_password
    keyAlias key_alias
    keyPassword key_password
    enableV1Signing true // Clover app APKs must use V1 signing (JAR signing)
    enableV2Signing false // prevents APKs from being signed with V2 scheme
    
  7. In the buildTypes.release block, add the following property:

    signingConfig signingConfigs.release
    
  8. Save and close the build file.

Generating an APK with Gradle

Once your Android build is configured for signed APKs, you can generate a new APK for uploading to the Clover App Market.

  1. Open a terminal window and change the current directory to the root of your project.
  2. Run gradle assembleRelease.
    The signed APK is created and available in {projectRoot}/{moduleName}/build/outputs/apk/release.

Did this page help you?