Home > Net >  Error in Build file: android\app\build.gradle line: 57
Error in Build file: android\app\build.gradle line: 57

Time:01-05

I'm running flutter build appbundle command and getting the error you can see on the image. what's wrong in signingConfigs.

   signingConfigs {
       release {
           keyAlias keystoreProperties['keyAlias']
           keyPassword keystoreProperties['keyPassword']
           storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
           storePassword keystoreProperties['storePassword']
       }
   }
   buildTypes {
       release {
           signingConfig signingConfigs.release
       }
   }

enter image description here

CodePudding user response:

You have to add the below file into an android folder directly.

location

Inside the key.properties write the below code

 storePassword="storepassword"
 keyPassword="keypassword"
 keyAlias=upload
 storeFile=/Users/...your..keystore..location/keystore.jks

Also, update the android/app/build.gradle file

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

CodePudding user response:

It might be possible that you are missing keystoreProperties file. This file is typically not checked in to source control, so if you are collaborating with others, ask your friends or coworkers to send you that file.

CodePudding user response:

@WSBT is correct after that use code below

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

CodePudding user response:

Got the Error solved: Could not get unknown property 'keystoreProperties'

Replaced this code:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

With this code: in android/app/build.gradle file.

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

as suggested here: https://docs.flutter.dev/deployment/android#configure-signing-in-gradle

  • Related