有麻烦生成Android gradle签名和zipaligned apk

时间:2014-10-14 00:43:40

标签: android build.gradle intellij-13

我无法在Android应用中获得已签名的zipaligned gradle文件。我正在使用intellij 13.1.4。我收到的错误是错误:(34,0)在BuildTypeDsl_Decorated上找不到属性'configstd'{name = release,debuggable = false,jniDebugBuild = false,renderscriptDebugBuild = false,renderscriptOptimLevel = 3,packageNameSuffix = null,versionNameSuffix = null ,runProguard = false,zipAlign = true,signingConfig = null}。

这是我的build.gradle:

`    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:0.9.+'
         }
    }
    apply plugin: 'android'

    repositories {
        mavenCentral()
    }

    android {
        compileSdkVersion 19
         buildToolsVersion '20.0.0'
        defaultConfig {
            minSdkVersion 14
            targetSdkVersion 19
        }
        signingConfigs {
            configstd {
                keyAlias 'myalias'
                keyPassword 'mykeypassword'
                storeFile file('mykeyfile.jks')
                storePassword 'mystorepassword'
            }
        }
        buildTypes {
            release {
                debuggable false
                zipAlign true
                signingConfig configstd
            }
            debug {
                debuggable true
                zipAlign false
                signingConfig configstd
            }
        }
    }

    dependencies {

        compile 'com.android.support:support-v4:19.+'
        compile 'com.android.support:appcompat-v7:19.+'
    }
`

1 个答案:

答案 0 :(得分:0)

这是我发现的问题。我最初使用了intellij的Project Structure-> Facets-> Android-Gradle来输入build.gradle文件的参数。显然,当它创建要插入到文件中的代码时,它会从对象configstd的名称中删除“signingConfigs”。换句话说,该行应如下所示:

signingConfig signingConfigs.configstd