android - 签署Apk时发生错误:找不到

标签 android gradle signing

Gradle说它找不到用于签名apk的'signingConfig()'方法。

它还列出了可能的原因:

1)该项目可能正在使用不包含该版本的gradle版本。

2)构建文件可能缺少Gradle插件。

这是我的grade.build:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
    applicationId "happy.blumental.maxim.testproject"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}

signingConfigs {
    release {
        keyAlias('releaseKey')
        storeFile file('mykeystore.jks')
        keyPassword('key')
        storePassword('store')
    }
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfigs signingConfigs.release
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
compile "com.android.support:appcompat-v7:$support_version"
compile "com.android.support:support-v4:$support_version"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "io.reactivex:rxjava:1.0.14"
compile('io.reactivex:rxkotlin:0.24.100') { exclude module: 'funktionale' }
compile "io.reactivex:rxandroid:1.0.1"
compile "com.jakewharton.rxbinding:rxbinding-kotlin:0.3.0"
compile 'org.jetbrains.kotlin:kotlin-reflect:1.0.0-beta-1038'

compile 'com.trello:rxlifecycle:0.3.0'
compile 'com.trello:rxlifecycle-components:0.3.0'

compile 'com.parse:parse-android:1.10.2'
}

Properties props = new Properties()
props.load(project.rootProject.file('local.properties').newDataInputStream())
String parseAppId = props.getProperty('parse.app_id') ?: "Specify APP_ID"
String parseClientKey = props.getProperty('parse.client_key') ?: "Specify CLIENT_KEY"

android.buildTypes.each { type ->
type.buildConfigField 'String', 'PARSE_APP_ID', "\"$parseAppId\""
type.buildConfigField 'String', 'PARSE_CLIENT_KEY', "\"$parseClientKey\""
}

我使用gradle插件1.4.0-beta6。

这是我的错误日志:

Error:(30, 0) Gradle DSL method not found: 'signingConfigs()' Possible causes:

  • The project 'TestProject' may be using a version of Gradle that does not contain the method. Open Gradle wrapper file
  • The build file may be missing a Gradle plugin. Apply Gradle plugin
  • 最佳答案

    将发布buildType中的属性从signingConfigs重命名为signingConfig,方法是:

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
    

    看看the dsl reference,您拼写了属性名称。

    关于android - 签署Apk时发生错误:找不到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33720103/

    相关文章:

    Android gradle构建时间呈指数增长

    java - 仅当 JAR 已签名时才会出现 ClassNotFoundException

    ios - 代码签名错误: Code signing is required for product type 'Application' in SDK 'iOS 11.4'

    android - unity google play 应用程序签名问题和 keystore

    android - Android Studio无法正确安装构建apk文件。引发异常

    java - 这是内存泄漏吗?

    Android 的 repo 工具因 python2 而失败

    android - 为什么我要用 HPROF 查看器和分析器查找 "Duplicate Strings"?

    android - 有什么方法可以检测 Android fragment 中的 userInterations 吗?

    gradle - 如何在 Gradle 中设置 Groovydoc 的字符编码?