'Keystore file not set for signing config release flutter (when trying release mode)
Hey there I need your help. I know there are many threads with this error, but I tried every single solution and nothing is working.
I did everything like it's mention in the documentation to get my app bundle, but I always get this error:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file not set for signing config release
I made the key.properties like this and saved it in the android folder (C:\Users\Martin\Documents\tutorial\android):
storePassword=XXXXXX
keyPassword=XXXXXX
keyAlias=key
storeFile=/Users/Martin/key.jks
I created my own keystore file which is located in /Users/Martin/
And finally I changed my build.gradle as mentioned in the documentation.
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('app/key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.myID"
minSdkVersion 16
targetSdkVersion 29
multiDexEnabled true
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:multidex:1.0.3'
implementation platform('com.google.firebase:firebase-bom:26.1.1')
implementation 'com.google.firebase:firebase-auth'
}
I don't know if this is helpful, but if I try the debug mode
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
it works just fine and everything works.
√ Built build\app\outputs\bundle\release\app-release.aab (20.0MB).
What could cause this error in release mode but works in debug mode? Thanks for the help.
Solution 1:[1]
SIMILAR PROBLEM ON ANDROID STUDIO WITH JAVA
I've encountered with the similar issue and I'm writing how I resolved it. I wasn't even able to run the app, though the gradle was building the app well. I was getting this "Algorithm HmacPBESHA256 not available". And I tried these steps.
It is not a guaranteed solution but it at least worked for me.
- Keep the Android Studio running.
- Open C:\Android.android and Cut-Paste the "debug.keystore" file somwhere else. I'd prefer outside the C drive.
- Now go to C:\users{User Name}.android and delete or Cut-Paste the "debug.keystore" file.
- Now run your project in Android Studio.
- If the app got built, BINGO !!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

