构建脚本错误,不支持的摇篮DSL方法找到:'signingConfig() [英] Build script error, unsupported Gradle DSL method found: 'signingConfig()'

查看:292
本文介绍了构建脚本错误,不支持的摇篮DSL方法找到:'signingConfig()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想的gradle设置创建Android Studio中0.4.5一个谷歌Play商店发布。在设置的gradle,我使用的是默认的包装的gradle。我用Project Properties对话框设置签署配置和'释放'建设类型。我只有一个构建模块。下面是导致该文件的build.gradle:

I'm trying to setup gradle to create a Google Play store release in Android Studio 0.4.5. In gradle settings, I am using the default gradle wrapper. I used the Project Properties dialog to set up the signing config and 'release' build type. I only have one build module. Here is the build.gradle file that resulted:

    apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '19.0.1'
    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 19
        versionCode 10
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            debuggable false
            signingConfig playstore
            proguardFile 'proguard-rules.txt'
        }
    }
    signingConfigs {
            playstore {
            keyAlias 'mykeyalias'
            storeFile file('playstore.jks')
            keyPassword 'xxxxx'
            storePassword 'xxxxx'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
    compile 'com.android.support:support-v4:+'
    compile files('libs/libGoogleAnalyticsServices.jar')
}

但是,当gradle这个尝试同步我收到以下错误:

But I am getting the following error when gradle tries to sync:

Build script error, unsupported Gradle DSL method found: 'signingConfig()'!
            Possible causes could be:  
            - you are using Gradle version where the method is absent 
            - you didn't apply Gradle plugin which provides the method
            - or there is a mistake in a build script

有什么我需要做的设置正确gradle这个?

Is there something I need to do to setup the correct gradle?

感谢名单提前。

推荐答案

首先定义你的 SigningConfigs 之前,你的 buildTypes 块。此外 Play商店中方法是在 signingConfigs ,所以你必须给像 signingConfigs的方式引用.playstore

First define your SigningConfigs before your buildTypes block . Also playstore method is inside signingConfigs so you have to give a reference in a manner like signingConfigs.playstore .

您最后的build.gradle 文件应该是这样的:

Your final build.gradle file should look like this :

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '19.0.1'
    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 19
        versionCode 10
        versionName "1.0"
    }

   signingConfigs {
            playstore {
              keyAlias 'mykeyalias'
              storeFile file('playstore.jks')
              keyPassword 'xxxxx'
              storePassword 'xxxxx'
        }
    }


    buildTypes {
        release {
            runProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            debuggable false
            signingConfig signingConfigs.playstore
            proguardFile 'proguard-rules.txt'
        }
    }

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
    compile 'com.android.support:support-v4:+'
    compile files('libs/libGoogleAnalyticsServices.jar')
}

这篇关于构建脚本错误,不支持的摇篮DSL方法找到:'signingConfig()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆