skip to Main Content

I’m getting an error "SigningConfig "release" is missing required property "storeFile"", whenever i try to run this command in terminal that is flutter run --release. Before i run this command multiple times but no error. Then i checked key.properties inside android folder and surprisingly that file is missing. I remembered that file was there but now it is missing and even in Github. Now i don’t remember my keyAlias , keyPassword & storePassword. How i solve this issue? i mean how i get those keyalias and password ?

Build.gradle

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('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 31

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.test.app"
        minSdkVersion 21
        multiDexEnabled true
        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"
    implementation platform('com.google.firebase:firebase-bom:28.4.0')
    implementation 'com.android.support:multidex:2.0.1'
    implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
    implementation 'com.google.firebase:firebase-messaging:20.1.0'
}

3

Answers


  1. In my case, I received this message on CI build only. The reason for that is the fact that I used git-crypt to encrypt keys.properties file. I used the wrong name for decrypting the file by git-crypt. I did not have a problem with my local builds because the file was already decrypted.

    Therefore, this message displays when the build system is unable to read the keys.properties file.

    This is the way I usually do in order to read the keys.properties file.

    def keystoreProperties = new Properties()
    def keystorePropertiesFile = rootProject.file('./keystore/key.properties')
    if (keystorePropertiesFile.exists()) {
        keystorePropertiesFile.withReader('UTF-8') { reader ->
            keystoreProperties.load(reader)
        }
    }
    

    and then

    signingConfigs {
            debug {
                keyAlias 'androiddebugkey'
                keyPassword 'android'
                storeFile file('../keystore/debug.keystore')
                storePassword 'android'
            }
    
            release {
                keyAlias keystoreProperties['keyAlias']
                keyPassword keystoreProperties['keyPassword']
                storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
                storePassword keystoreProperties['storePassword']
            }
        }
    
    Login or Signup to reply.
  2. key.properties file must add to your project for more info visit
    https://docs.flutter.dev/deployment/android

    Login or Signup to reply.
  3. in android/key.properties

    for my case…

    storePassword=**********
    keyPassword=**********
    keyAlias=upload
    storeFile=E:\upload-keystore.jks
    

    In window try to write path as

    storeFile=C:\Users\<Your user folder>\upload-keystore.jks
    instead of C:Users<Your user folder>upload-keystore.jks
    
    The important note is "\" in a path.
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search