I failed to build flutter app.
I wrote in tarminal of VSCode.
`flutter build appbundle --release````
but failed.
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\NAME\source\repos\NAME\work\flutter\APP_NAME\android\app\build.gradle' line: 58
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not get unknown property 'keystoreProperties' for SigningConfig$AgpDecorated_Decorated{name=release, storeFile=null, storePassword=null, keyAlias=null, keyPassword=null, storeType=pkcs12, v1SigningEnabled=true, v2SigningEnabled=true, enableV1Signing=null, enableV2Signing=null, enableV3Signing=null, enableV4Signing=null} of type com.android.build.gradle.internal.dsl.SigningConfig$AgpDecorated.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
build.gradle' line: 58 is a line starts from keyAlias...
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
I added these code at android\app\build.gradle
and I made android\app\key.jks
and I modified android\key.properties
storePassword=MYPASSWORD
keyPassword=MYPASSWORD
keyAlias=key
storeFile=key.jks
You need to add code like this to initialize the keystoreProperties, for example below the other "def" statements at the top of the file:
def keystoreProperties = new Properties()
def keystorePropertiesFile = file('/path/to/your/key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}