Keystore Not Found for Signing Config 'release'

Viewed 13629

I'm having a problem while running this command on Flutter: flutter build appbundle --target-platform android-arm,android-arm64,android-x64 which I need to run in order to execute flutter build apk.

build.gradle

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

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

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.release
        }
    }

key.properties

storePassword=XXXX
keyPassword=XXXX
keyAlias=key
storeFile="C:/Users/User/Key/key.jks"

Error:

* What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file 'D:\Projects\Flutter\iusefully\android\app\"C:\Users\User\Key\key.jks"' not found for signing config 'release'.
5 Answers

I finally found the answer, my problem was in the key.properties file. The problem occurred because I used storeFile="LOC" The declartion of this variable for the path of the .jks should NOT be in " " quotation.

WRONG: storeFile="C:/Users/User/Key/key.jks"

RIGHT: storeFile=C:/Users/User/Key/key.jks

In addition, I added the key.jks file to the /app folder.

Change your key location c to d drive... Same time permission issue occurred with c drive

For me it helped to rename file {home}\.android\debug.keystore to {home}\.android\debug.keystore.jks

In addition to t0m3r's answer, when running the command below on windows: change USER_NAME to your user name

keytool -genkey -v -keystore c:\Users\USER_NAME\upload-keystore.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias upload

Related