Skip to main content

Sign Apk Manually

In this section you will how to sign the android apk files manually.

info

If you use version v1.5.6 or above, you do not need to follow this guide as these modifications are already done for you in the application already. If you need to create release keys for your application, please follow this guide instead Use Tools Scripts

Getting Started#

In this section we will modify some of the source files to sign the release build of android applications.

Before you proceed

The following guide assumes that you have created a release keystore file or already have one which you will use to sign the release builds of your android application.

If you have not already created a release keystore, please do that first by following this guide Create Release Keystore.

If you have a release keystore please follow the steps mentioned below to sign your apk builds.

Open app in android studio#

Open woostore_pro application root folder in android studio. If you do not know how to open the application in android studio then please follow the guide here Open app in android studio.

Reference the keystore from the app#

Create a file named key.properties in woostore_pro/android directory.

woostore_pro / android / key.properties
storePassword=<password that use used to create release keystore>
keyPassword=<password that use used to create release keystore>
keyAlias=<file alias name which you used to create release keystore>
storeFile=<location of the key store file, such as /Users/<user name>/upload-keystore.jks>

You need to provide your values from the previous steps for the following variables:

  • storePassword
  • keyPassword
  • keyAlias
  • storeFile

After that save the file by pressing command + s on Mac OS or control + s on Windows

Warning

Keep the key.properties file private. Don’t check it into public source control.

For more information check out this Official Flutter Link

Configure signing in gradle#

Configure gradle to use your upload key when building your app in release mode by editing the woostore_pro / android / app / build.gradle file.

  1. Add the keystore information from your properties file before the android block:

    woostore_pro / android / app / build.gradle
    def keystoreProperties = new Properties()
    def keystorePropertiesFile = rootProject.file('key.properties')
    if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
    }
    android {
    ...
    }

    This will load the key.properties file into the keystoreProperties object.

  2. Replace the buildTypes block:

    buildTypes {
    release {
    // TODO: Add your own signing config for the release build.
    // Signing with the debug keys for now,
    // so `flutter run --release` works.
    signingConfig signingConfigs.debug
    }
    }

    With the signing configuration info:

    buildTypes {
    debug {
    signingConfig signingConfigs.debug
    }
    release {
    signingConfig signingConfigs.release
    }
    }

    Release builds of your app will now be signed automatically.

  3. Now Save the file by pressing command + s on Mac OS or control + s on Windows

note

You may need to run flutter clean after changing the gradle file. This prevents cached builds from affecting the signing process.

For more information check out this Official Flutter Link.

Your modifications for creating a signed apk with your release keystore is complete. Now you can follow the guide from where you came here.