Benyamin
Benyamin

Reputation: 1144

key.properties flutter APK build

I followed the instructions here Exactly.

this is my key.properties file: enter image description here this is my build.gradle file: enter image description here this is the error: enter image description here I even printed the file value and it is still wrong and not working. I tried the suggestions in the similar questions but they are not working for me.

Upvotes: 1

Views: 6400

Answers (2)

Omar Mahmoud
Omar Mahmoud

Reputation: 3067

remove the <> from storeFile and you already pointing to the folder just need the file name should be something like this

storeFile = key.jks

Upvotes: 1

G3nt_M3caj
G3nt_M3caj

Reputation: 2685

First of all remove “<” and “>” then the path needs double backslashes as follows (the absolute path it's ok):

storeFile=C:\\Users\\YourUser\\OtherFolder\\ProjectPath\\somefilekey.jks

after that in your build.gradle file you have to use as follows:

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


android {

    compileSdkVersion 30

  //…...

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
  //OR ……..
        debug {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }

   //…….


}

Upvotes: 5

Related Questions