Sign appbundle by flutter release build
I’ve set up the android build environment on my home desktop. It requires the sign certificate to be generated by Google Play console (using Setup/App integrity menu).
Flutter builds an appbundle and signs it using the upload certificate. Then Google Play console checks that appbundle is signed by that certificate when uploaded.
The problem is that now I’d like to build android application using a laptop I have.
However I forgot how flutter is configured to sign release builds.
Running flutter build appbundle
command on a laptop raises task error like
Execution failed for task ‘:app:validateSigningRelease’.
So my idea was to get all signing configuration from the desktop and copy to the laptop.
Signing certificate is stored in the .jks
file and have it on desktop computer.
It is not recommended to store .jks
file in the source control so I copied the file manually from the desktop to the laptop.
Android application project has android
subfolder that is used to configure application builds.
The android\.gitignore
prevents key.properties
file to be commited to the source control.
Theandroid/app/build.gradle
file configures the release signature
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
All signature settings (like keyPassword
, storeFile
etc) may be set using the andriod\key.properties
file.
This is plain text file used to initialize the build.gradle
configuration
storePassword=***
keyPassword=***
keyAlias=upload
storeFile=/home/user/upload-keystore.jks
Having passwords in the plain text file does not look very secure.
Now I can build a release of my flutter application and get it signed with the upload certificate using key from .jks
file.
Then appbundle is uploaded to Google Play server and .apk
files are signed by Google automatically.