Gradle说它找不到用于签名apk的'signingConfig()'方法。
它还列出了可能的原因:
1)该项目可能正在使用不包含该版本的gradle版本。
2)构建文件可能缺少Gradle插件。
这是我的grade.build
:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "happy.blumental.maxim.testproject"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
signingConfigs {
release {
keyAlias('releaseKey')
storeFile file('mykeystore.jks')
keyPassword('key')
storePassword('store')
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfigs signingConfigs.release
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
compile "com.android.support:appcompat-v7:$support_version"
compile "com.android.support:support-v4:$support_version"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "io.reactivex:rxjava:1.0.14"
compile('io.reactivex:rxkotlin:0.24.100') { exclude module: 'funktionale' }
compile "io.reactivex:rxandroid:1.0.1"
compile "com.jakewharton.rxbinding:rxbinding-kotlin:0.3.0"
compile 'org.jetbrains.kotlin:kotlin-reflect:1.0.0-beta-1038'
compile 'com.trello:rxlifecycle:0.3.0'
compile 'com.trello:rxlifecycle-components:0.3.0'
compile 'com.parse:parse-android:1.10.2'
}
Properties props = new Properties()
props.load(project.rootProject.file('local.properties').newDataInputStream())
String parseAppId = props.getProperty('parse.app_id') ?: "Specify APP_ID"
String parseClientKey = props.getProperty('parse.client_key') ?: "Specify CLIENT_KEY"
android.buildTypes.each { type ->
type.buildConfigField 'String', 'PARSE_APP_ID', "\"$parseAppId\""
type.buildConfigField 'String', 'PARSE_CLIENT_KEY', "\"$parseClientKey\""
}
我使用gradle插件1.4.0-beta6。
这是我的错误日志:
Error:(30, 0) Gradle DSL method not found: 'signingConfigs()' Possible causes:
The project 'TestProject' may be using a version of Gradle that does not contain the method. Open Gradle wrapper file The build file may be missing a Gradle plugin. Apply Gradle plugin
最佳答案
将发布buildType中的属性从signingConfigs
重命名为signingConfig
,方法是:
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
看看the dsl reference,您拼写了属性名称。
关于android - 签署Apk时发生错误:找不到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33720103/