I followed the instructions to build release for Android and it was successful. https://flutter.io/docs/deployment/android#configure-signing-in-gradle
However, this project is open source and without the keys.properties file it will fail to build. This means that contributors are unable to run the project.
How do I setup build.gradle to sign debug with debug keys when doing a --debug or --profile build and with release keys from keys.properties with a --release build?
Use debug mode during development, when you want to use hot reload. Use profile mode when you want to analyze performance.
this will use release keys only if the key.properties file exists
signingConfigs {
    release {
        if (keystorePropertiesFile.exists()) {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }
}
buildTypes {
    release {
        if (keystorePropertiesFile.exists()) {
            signingConfig signingConfigs.release
            println "Signing with key.properties"
        } else {
            signingConfig signingConfigs.debug
            println "Signing with debug keys"
        }
    }
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With