Android gradle 签名配置错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22790801/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android gradle signingConfig error
提问by Olkunmustafa
I try signing my Application like this link. I write my signingConfigs settings but I get "Could not find property" error.
我尝试像这个链接一样签署我的应用程序。我编写了我的签名配置设置,但出现“找不到属性”错误。
This my build.gradle
这是我的 build.gradle
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.0.3'
defaultConfig {
minSdkVersion 11
targetSdkVersion 19
versionCode 1
versionName "Andy Warhol"
}
buildTypes {
debug {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
debuggable false
jniDebugBuild false
signingConfig signingConfigs.myconfig
}
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
debuggable false
jniDebugBuild false
}
}
signingConfigs {
myconfig {
keyAlias 'xxx'
keyPassword 'xxx'
storeFile file('xxx')
storePassword 'xxx'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms:play-services:4.0.30'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/picasso-2.2.0.jar')
compile files('libs/acra-4.5.0.jar')
compile files('libs/libGoogleAnalyticsServices.jar')
}
This is my error
这是我的错误
Gradle 'BulentTirasMobileApp' project refresh failed: Could not find property 'myconfig' on SigningConfig container.
Gradle 'BulentTirasMobileApp' 项目刷新失败:在 SigningConfig 容器上找不到属性 'myconfig'。
回答by CommonsWare
Move your signingConfigs
block to appear before your buildTypes
block:
移动您的signingConfigs
块以出现在您的buildTypes
块之前:
signingConfigs {
myconfig {
keyAlias 'xxx'
keyPassword 'xxx'
storeFile file('xxx')
storePassword 'xxx'
}
}
buildTypes {
debug {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
debuggable false
jniDebugBuild false
signingConfig signingConfigs.myconfig
}
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
debuggable false
jniDebugBuild false
}
}
You need to define the configuration before you can use it.
您需要先定义配置,然后才能使用它。