找不到Gradle DSL方法:storeFile() [英] Gradle DSL method not found: storeFile()
问题描述
我正在使用Android Studio 1.1.0.当我尝试同步Gradle文件时,出现以下错误:
I'm using Android Studio 1.1.0. When I try to sync my Gradle file, I get the following error:
找不到等级DSL方法:storeFile()
Gradle DSL method not found:storeFile()
这是我的gradle配置:
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 "#####"
}
}
}
任何人都可以帮忙吗?
推荐答案
需要注意的几点:
storeFile
DSL方法具有以下签名:
The storeFile
DSL method has the following signature:
public DefaultSigningConfig setStoreFile(File storeFile)
即它期望传递File
对象.您可能需要在代码中放置一个File
构造函数,以确保您实际上在创建File
对象.因为您当前没有传递文件,所以Gradle抱怨它找不到具有适当签名的方法.
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.
第二,您当前在文件名后附加两个后缀:.jks
和.keystore
.您仅应基于所引用文件的后缀包括其中之一(可能为.jks
,但应进行确认).
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")
或
storeFile file(project.property("Students_tracking_keystore") + ".jks")
或
storeFile file(project.property("Students_tracking_keystore.keystore"))
或
storeFile file(project.property("Students_tracking_keystore.jks"))
这篇关于找不到Gradle DSL方法:storeFile()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!