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.
