8

I'm using Android Studio 1.1.0. When I try to sync my Gradle file, I get the following error:

Gradle DSL method not found:storeFile()

Here is my gradle configuration:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "skripsi.ubm.studenttracking"
        minSdkVersion 16
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }

    signingConfigs {
        release {
            storeFile (project.property("Students_tracking_keystore.jks") + ".keystore")
            storePassword "####"
            keyAlias "####"
            keyPassword "#####"
        }
    }
}

Can anyone help?

stkent
  • 19,772
  • 14
  • 85
  • 111
Leonard Febrianto
  • 964
  • 2
  • 12
  • 37

1 Answers1

7

A couple of things to note:

The storeFile DSL method has the following signature:

public DefaultSigningConfig setStoreFile(File storeFile)

i.e. it expects a File to be passed in. You probably need to place a File constructor in your code to ensure you are actually creating a File object. Because you're currently not passing in a file, Gradle is complaining that it can't find a method with the appropriate signature.

Secondly, you are currently appending two suffices to the filename: .jks and .keystore. You should only include one of these based on the suffix of the file you are referencing (it's probably .jks, but you should check to be sure).

In short, one of the following replacement lines will probably work for you:

storeFile file(project.property("Students_tracking_keystore") + ".keystore")

or

storeFile file(project.property("Students_tracking_keystore") + ".jks")

or

storeFile file(project.property("Students_tracking_keystore.keystore"))

or

storeFile file(project.property("Students_tracking_keystore.jks"))
stkent
  • 19,772
  • 14
  • 85
  • 111
  • where do i put the `public DefaultSigningConfig setStoreFile(File storeFile)` ? – Leonard Febrianto Mar 17 '15 at 02:52
  • You don't, that's the underlying java-style method that build.gradle is referencing. – stkent Mar 17 '15 at 02:53
  • 1
    So whats the solution for this ? i just want to build my application into apk so i can test it in real device. – Leonard Febrianto Mar 17 '15 at 02:55
  • @stkent just replace the line that contains `storeFile` in your `build.gradle` with any of the suggested codes above or simply type `storeFile file("Students_tracking_keystore.jks");` if the jks file is already located at the root of your project folder. – ecle Mar 17 '15 at 03:17
  • @ecle just saw this but I think your comment was aimed at the OP :) – stkent Dec 26 '15 at 14:28