4

Working on a Flutter app and I have tried all of the fixes listed on here previously and nothing has worked. I believe everything is configured correctly and in the correct places, so I need help figuring out why the signing config is still throwing this error. I have been trying for hours to find another solution with no luck. Everything is spelled correctly too. The error is below.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file not set for signing config release

The key.properties folder is in the main android folder, and the upload-keystore.jks file is within android/app.

key.properties is

storePassword=xxxx
keyPassword=xxxx
keyAlias=upload
storeFile=/Users/..../android/app/upload-keystore.jks

And full build.gadle is

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: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'  // Google Services plugin

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 30

    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.fytfeed.fytfeed"
        minSdkVersion 23
        targetSdkVersion 30
        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"
}

4 Answers 4

6

Well after a day of banging my head against the wall I figured this one out. I had an unknown space in my key.properties folder at the beginning of the file name that was throwing the error. So if everything checks out, be on the lookout for random spaces!

Sign up to request clarification or add additional context in comments.

Comments

2
  • Regenerate the key

OR

Open the project "/android" in Android studio

  • Build -> Generate Signed Bundle / APK ..

  • Complete the steps...

Comments

1

just select your proper path of JKS file in key.properties and re run

Comments

0

After sometime I realize that I am not using the same computer and the path in key.properties might be different, in this case I am using Linux instead macbook, so the path is different, I changed to Linux path and it worked

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.