21

I am trying to test an app with Build Variant in release mode in Android Studio with a project using Gradle.

build.gradle:

(omitted dependencies and repositories)

android {
    apply plugin: 'android'
    compileSdkVersion 19
    buildToolsVersion "19.0.0"

    defaultConfig {
        minSdkVersion 11
        targetSdkVersion 16
        versionCode 1
        versionName "1.0"
    }

    signingConfigs {
        release {
            storeFile file("release.jks")
            storePassword "password"
            keyAlias "MobileAndroid"
            keyPassword "password"
        }
    }

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

If the Build Variant is release Gradle returns an error

A problem was found with the configuration of task ':app:packageRelease'.

File '/Users/andre/workspace/MobileAndroid/app/release.jks' specified for property 'signingConfig.storeFile' does not exist.

Removing "signingConfig.storeFile" returns an Android Studio message box error:

Application Installation Failed

Installation failed since the APK was either not signed, or signed incorrectly. If this is a Gradle-based project, then make sure the signing configuration is specified in the Gradle build script.

release.jks exists and using the Android Studio wizard "Build > Generate Signed APK..." I can generate an app.apk signed.

How do I solve this error in Gradle?

André Ricardo
  • 3,051
  • 7
  • 23
  • 32
  • use `.keystore` instead of `.jks` and let me know – Piyush Agarwal Feb 14 '14 at 14:28
  • Take a look at https://github.com/ethankhall/driving-time-tracker/blob/master/build.gradle and https://github.com/ethankhall/driving-time-tracker/blob/master/signing.gradle.example for how I sign apps – Ethan Feb 14 '14 at 15:08
  • @pyus13 renaming to keystore did not change the error – André Ricardo Feb 14 '14 at 16:04
  • 1
    Sorry for the obvious question, but the store file is at the directory where it's complaining about in the error message (in your app directory)? Have you checked to see if there are permissions problems that would prevent reading it? – Scott Barta Feb 14 '14 at 16:13
  • @ScottBarta the release.jks was one folder up, but for some reason before I upgraded Android Studio it found the release.jks in the root folder. Anyway this solved my issue thanks! – André Ricardo Feb 14 '14 at 16:23
  • Okay, cool, added as an official answer. – Scott Barta Feb 14 '14 at 16:25

5 Answers5

24

Please double-check that the file exists at the place the error message is looking (Users/andre/workspace/MobileAndroid/app/release.jks) and that there are no permissions problems preventing the files from being read.

Scott Barta
  • 79,344
  • 24
  • 180
  • 163
10

For me it was because i was entering in just the name of the key when it was asking for the full path.

enter image description here

j2emanue
  • 60,549
  • 65
  • 286
  • 456
3

For me: I just indicated the .jks file from the explorer.

enter image description here

Milon
  • 2,221
  • 23
  • 27
0

Might be helpful for someone - I was getting the same message "specified for property 'signingConfig.storeFile' does not exist”

Somehow in my case when i changed laptops keystore files got corrupted/tempered while transferring it from one to another. I would suggest not to zip the file, Just transfer it as it is.

When i transferred again without zipping, It worked like a charm!!!

Ash
  • 1,391
  • 15
  • 20
0

enter image description here

If you want to create signed version of apk then it requires release. If you don't want to, choose the debug mode and run the unsigned apk file.

Blue
  • 22,608
  • 7
  • 62
  • 92
  • Welcome to Stack Overflow! I highly recommend reading [Writing the Perfect Question](https://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/) and more specifically the "Spelling, grammar and formatting" section. I've corrected this post, and fixed some of the common mistakes, but on future posts reading this article would go a long way to making high quality posts for future visitors. – Blue Aug 29 '16 at 11:09