Flutter Picking Wrong Keystore path and giving error key.jks not found

Yeah, for me... I forgot to change my signingConfig to singingConfigs.release in my build.gradle file.

    buildTypes {
        release {
           //CHANGE THIS TO RELEASE
            signingConfig signingConfigs.debug
        }
    }

it's wherever call it from in your build.gradle. insert this:

signingConfigs {
release {
    keyAlias keystoreProperties['keyAlias']
    keyPassword keystoreProperties['keyPassword']
    storeFile file(keystoreProperties['storeFile'])
    storePassword keystoreProperties['storePassword']
  }
}

and call this in above your android{}:

def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

and that key.properties file (which should be in your root android folder) should have this:

storePassword=12345
keyPassword=12345
keyAlias=key
storeFile=/Users/me/somekey.jks

modified key.properties file with

storePassword=123456
keyPassword=123456
keyAlias=key
storeFile=key.jks

instead of this

storePassword=123456
keyPassword=123456
keyAlias=key
storeFile=D:\flutterapps\testapp\key.jks

and also moved key.jks to D:\flutterapps\testapp\android\app\key.jks

as this path shown in error inside terminal

Thanks all.


On Windows you have to use 2 backslashes to indicate the path separation. In your key.properties, you should have something like this:

storeFile=D:\\flutterapps\\testapp\\key.jks

You don't need to copy your key.jks file to your flutter project.

Tags:

Dart

Flutter