【问题标题】:Error during signing apk: unable to find签署 apk 时出错:找不到
【发布时间】:2015-11-15 13:16:24
【问题描述】:

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。

这是我的错误日志:

错误:(30, 0) Gradle DSL 方法未找到:'signingConfigs()' 可能的原因:

  • 项目“TestProject”可能正在使用不包含该方法的 Gradle 版本。 打开 Gradle 包装文件
  • 构建文件可能缺少 Gradle 插件。 应用 Gradle 插件
  • 【问题讨论】:

    • google unable to find 'signingConfig()' method 并尝试任何结果,例如 stackoverflow.com/questions/22790801/…
    • 我做到了。但是那里提到的修复在我的情况下不起作用。通常人们会将 buildTypes 放在 signingConfigs 之上或做一些拼写错误,但事实并非如此。
    • 请输入你的日志错误

    标签: android gradle signing


    【解决方案1】:

    将您的发布 buildType 中的属性从 signingConfigs 重命名为 signingConfig 为:

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

    看看the dsl reference,你拼错了属性名。

    【讨论】:

      猜你喜欢
      • 2013-10-07
      • 1970-01-01
      • 2020-08-17
      • 1970-01-01
      • 2019-02-14
      • 1970-01-01
      • 2022-06-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多