7

I want to release my app but stack with this issue

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file 'D:\FlutterProjects\Panaszok\02012020 - Copy (2) - Copy\Multi Restaurants Flutter App\android\app\key\panaszok.jks' not found for signing config 'release'.

* 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.

* Get more help at https://help.gradle.org

BUILD FAILED in 23s
Running Gradle task 'assembleRelease'...                           23.9s
Gradle task assembleRelease failed with exit code 1
Process finished with exit code 1



----------------------------------Here is my build gradle-------------------------------------------------

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

    def flutterRoot = localProperties.getProperty('flutter.sdk')
    if (flutterRoot == null) {
        throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
    }

    def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
    if (flutterVersionCode == null) {
        flutterVersionCode = '1'
    }

    def flutterVersionName = localProperties.getProperty('flutter.versionName')
    if (flutterVersionName == null) {
        flutterVersionName = '1.0'
    }

    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-android'
    apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

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

    android {
        compileSdkVersion 28

        sourceSets {
            main.java.srcDirs += 'src/main/kotlin'
        }

        lintOptions {
            disable 'InvalidPackage'
        }

        defaultConfig {
            // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
            applicationId "com.panaszok.app"
            minSdkVersion 21
            targetSdkVersion 28
            versionCode flutterVersionCode.toInteger()
            versionName flutterVersionName
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }

        signingConfigs {
            release {
                keyAlias keystoreProperties['keyAlias']
                keyPassword keystoreProperties['keyPassword']
                storeFile file(keystoreProperties['storeFile'])
                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.debug
                signingConfig signingConfigs.release
            }
        }
    }

    flutter {
        source '../..'
    }

    dependencies {
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        implementation 'com.google.firebase:firebase-messaging:20.0.1'
        implementation 'androidx.annotation:annotation:1.1.0'
        implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'androidx.test:runner:1.1.1'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    }

    //apply plugin: 'com.google.gms.google-services'

----------------------------------------here is Key properties-----------------------------------------

storePassword=myPss
keyPassword=MyKpss
keyAlias=key
storeFile=D:/FlutterProjects/Panaszok/02012020 - Copy (2) - Copy/Multi Restaurants Flutter App/android/app/key/panaszok.jks

--------------------------------------Here is flutter doctor -v-----------------------------------------

    [√] Flutter (Channel stable, v1.12.13+hotfix.7, on Microsoft Windows [Version 10.0.18363.657], locale en-US)
        • Flutter version 1.12.13+hotfix.7 at C:\src\flutter
        • Framework revision 9f5ff2306b (3 weeks ago), 2020-01-26 22:38:26 -0800
        • Engine revision a67792536c
        • Dart version 2.7.0


    [√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
        • Android SDK at C:\Users\Office\AppData\Local\Android\sdk
        • Android NDK location not configured (optional; useful for native profiling support)
        • Platform android-29, build-tools 29.0.2
        • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
        • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
        • All Android licenses accepted.

    [√] Android Studio (version 3.5)
        • Android Studio at C:\Program Files\Android\Android Studio
        • Flutter plugin version 43.0.1
        • Dart plugin version 191.8593
        • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

    [√] VS Code (version 1.41.1)
        • VS Code at C:\Users\Office\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.7.1

    [√] Connected device (1 available)
        • Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator)

• No issues found!

I tried this method but it did not help and gave another error

 buildTypes {
        release {
            shrinkResources true
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
        }
    }

----------------------------------Error after minifyEnabled false--------------------------------------------

FAILURE: Build failed with an exception.

* Where:
Build file 'D:\FlutterProjects\Panaszok\02012020 - Copy (2) - Copy\Multi Restaurants Flutter App\android\build.gradle' line: 28

* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > Removing unused resources requires unused code shrinking to be turned on. See http://d.android.com/r/tools/shrink-resources.html for more information.

* 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.

* Get more help at https://help.gradle.org

BUILD FAILED in 870ms
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done                       1.5s
Gradle task assembleRelease failed with exit code 1
3
  • are you totally sure about this path D:\FlutterProjects\Panaszok\02012020 - Copy (2) - Copy\Multi Restaurants Flutter App\android\app\key\panaszok.jks ? Commented Feb 15, 2020 at 0:20
  • @Mohamed Sayed oh, i had issue with path, thanks now it worked Commented Feb 15, 2020 at 11:25
  • glad it worked.. Commented Feb 15, 2020 at 12:14

3 Answers 3

9

The issue is clear

Keystore file not found for signing config 'release'

check this path

'D:\FlutterProjects\Panaszok\02012020 - Copy (2) - Copy\Multi Restaurants Flutter App\android\app\key\panaszok.jks'
Sign up to request clarification or add additional context in comments.

Comments

4

You should check the keyAlias, storeFile .. informations in the key.properties file. If your key.properties file is different from your signature file, you will get this error.

Comments

0

In my case the problem was different. Running this command on Win 10: "keytool -genkey -v -keystore c:\Users\HP\upload-keystore.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias upload" actually creates file with this name: "HPUsersHPupload-keystore.jks". But the build command expects a file with this name: "upload-keystore.jks". Entering the created file name with its original form as HPUsersHPupload-keystore.jks on key.properities file did not work. The error was like this:

* What went wrong:

Execution failed for task ':app:validateSigningRelease'.

> Keystore file 'F:\flutterapps\taxiapp\taxi-mysql\taxi_app\android\app\HPUsersHPupload-keystore.jks' not found for signing config 'release'.

Even though the mentioned path on the error does contain the file and everything on total path and key.properities file was correct. The solution is just change the file name of keystore file manually, in my case from "HPUsersHPupload-keystore.jks" to "upload-keystore.jks" and it solved the issue totally. Hope it helps somebody.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.