Search code examples
androidgradlebuild.gradleandroid-keystore

Error building Android app in release mode, in Android Studio


I'm trying to sign my android app in release mode, in Android Studio.

I followed this official guide. So I have created the keystore and a private key. Then I tried to Generate the Signed APK, from Build -> Generate Signed API Key. But the build fails, with the following error:

:app:packageRelease FAILED
Error:A problem was found with the configuration of task ':app:packageRelease'.
> File 'C:\Documents\myapp\android.jks' specified for property 'signingConfig.storeFile' does not exist.

I have also checked the build.gradle configuration. And I have found this:

   signingConfigs {
        releaseConfig {
            keyAlias 'xxxxxxxxxx'
            keyPassword 'xxxxxxxxx'
            storeFile file('C:\Documents\myapp\android.jks')
            storePassword 'xxxxxxxxx'
        }
    }

but in the same gradle file I have this:

buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.releaseConfig
        }
    }

What's wrong?


Solution

  • I have solved the problem, simply moving the keystore inside the base path of my android project.