简体   繁体   English

如何使用 AppCenter 上上传的发布密钥库对 Android 发布版本进行签名?

[英]How to sign Android release build using uploaded release keystore on AppCenter?

My question is regarding this document, Android Code Signing Setup in App Center .我的问题是关于这个文档, Android Code Signing Setup in App Center

For some reason, my company prefers to not have release.keystore under version control.出于某种原因,我的公司不希望release.keystore受版本控制。 So, I want to use Upload everything to App Center .所以,我想使用Upload everything to App Center Unfortunately, they didn't provide any sample code I follow like what they did for Storing Signing Details in the Repository with Environment Variables .不幸的是,他们没有提供任何我遵循的示例代码,就像他们为使用环境变量在存储库中存储签名详细信息所做的那样。

So, I am wondering has anyone have the experience of that?所以,我想知道有没有人有这方面的经验? I uploaded my release.keystore into AppCenter, I added the Store pass, Key Alias, and Key pass.我将release.keystore上传到 AppCenter,添加了 Store pass、Key Alias 和 Key pass。 I don't know how to reference it then in my build config file.我不知道如何在我的构建配置文件中引用它。 Should I reference it?我应该参考它吗? If yes, how?如果是,如何? If no, then what might be the issue?如果不是,那么可能是什么问题?

Currently, my build file looks like this:目前,我的构建文件如下所示:

android {
    ....

    signingConfigs {
        debug {
            keyAlias 'androiddebugkey'
            keyPassword 'android'
            storePassword 'android'
            storeFile file('../keystore/debug.keystore')
        }

        release {

        }
    }
....
}

And this is the error I got on AppCenter:这是我在 AppCenter 上遇到的错误:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file not set for signing config release

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

This is how I configured on AppCenter:这是我在 AppCenter 上的配置方式:

在此处输入图像描述

I finally figured it out:我终于想通了:

  1. Delete release block from signingConfigs under the app/build.gradle file.app/build.gradle文件下的signingConfigs中删除发布块。
  2. Delete signingConfig signingConfigs.release from the buildTypes.release .从 buildTypes.release 中删除signingConfig signingConfigs.release buildTypes.release

Note: Step 2 is required if you want to keep lines under the release block.注意:如果要将行保留在发布块下,则需要执行第 2 步。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM