Android的摇篮signingConfig错误摇篮、错误、Android、signingConfig

2023-09-13 01:23:38 作者:云中藏酒

我尝试登录我像this链接。 我写我的signingConfigs设置,但我得到找不到属性的错误。

I try signing my Application like this link. I write my signingConfigs settings but I get "Could not find property" error.

这我build.gradle

This my 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')
    }

这是我的错误。

摇篮BulentTirasMobileApp项目刷新失败: 找不到属性myconfig上SigningConfig容器。

Gradle 'BulentTirasMobileApp' project refresh failed: Could not find property 'myconfig' on SigningConfig container.

对不起不好英语。 谢谢你。

Sorry bad english. Thank you.

推荐答案

移动你的 signingConfigs 块之前,您 buildTypes 块:

Move your signingConfigs block to appear before your buildTypes block:

    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.