我正在我的应用程序中实现材料设计。
我收到错误消息“错误:(2,0)在项目':app'上找不到属性'release'。”在建立我的gradle时
这是我的gradle代码:
apply plugin: 'com.android.application'
name=release
storeFile=null
storePassword=null
keyAlias=null
keyPassword=null
storeType=null
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.rey.material.demo"
minSdkVersion 9
targetSdkVersion 21
versionCode 5
versionName "0.0.5"
}
signingConfigs {
release {
storeFile file(MATERIAL_KEYSTORE_FILE)
storePassword MATERIAL_KEYSTORE_PASSWORD
keyAlias MATERIAL_KEYSTORE_ALIAS
keyPassword MATERIAL_KEYSTORE_PASSWORD
}
}
buildTypes {
release{
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),proguard-rules.pro'
signingConfig signingConfigs.release
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:cardview-v7:22.2.0'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
compile project(':lib')
}
请帮我,
谢谢。
最佳答案
您实际上不需要以下代码
name=release
storeFile=null
storePassword=null
keyAlias=null
keyPassword=null
storeType=null
删除这些行,然后再次检查!
现在应该看起来像这样
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.rey.material.demo"
minSdkVersion 9
targetSdkVersion 21
versionCode 5
versionName "0.0.5"
}
signingConfigs {
release {
storeFile file('MATERIAL_KEYSTORE_FILE_Path')
storePassword 'password'
keyAlias 'keyAliasName'
keyPassword 'MATERIAL_KEYSTORE_PASSWORD'
}
}
buildTypes {
release{
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),proguard-rules.pro'
signingConfig signingConfigs.release
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:cardview-v7:22.2.0'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
compile project(':lib')
}
关于android - 在项目':app'上找不到属性'release'错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32070410/