gpt4 book ai didi

android - gradle属性中的正确配置键

转载 作者:行者123 更新时间:2023-11-29 15:38:18 27 4
gpt4 key购买 nike

我正在尝试使用 android studio 将我的 apk 直接上传到 playstore。

使用 ribot 样板我可以看到他们将 key 放在 gradle.properties 中,如下所示:

ribotAppKeystoreReleaseLocation = keystore/release.keystore
ribotAppReleaseKeyAlias = UNDEFINED
ribotAppReleaseStorePassword = UNDEFINED
ribotAppReleaseKeyPassword = UNDEFINED

并在构建 gradle 中:

    // You must set up an environment var before release signing
// Run: export RIBOT_APP_KEY={password}
release {
storeFile file("${ribotAppKeystoreReleaseLocation}")
keyAlias "${ribotAppReleaseKeyAlias}"
storePassword "${ribotAppReleaseStorePassword}"
keyPassword "${ribotAppReleaseKeyPassword}"
}

如果我在 gradle.properties 中编写我的 key ,例如:

ribotAppReleaseStorePassword = THISISMYKEY

我将它上传到 git 时会遇到问题,因为所有团队都会看到这个 key 。那么,我可以在这里设置系统环境变量吗?或者我应该怎么做?

See full boilerplate

最佳答案

Can I set the variables in the local file

当然:

apply plugin 'com.android.application'

def keystorePropertiesFile = file('keystore.properties')
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
compileSdkVersion 26
buildToolsVersion '26.0.1'

defaultConfig {
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName '0.0.1'
}

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}

buildTypes {
release {
signingConfig signingConfigs.release
}
}
}

在这里,我有一个单独的 keystore.properties 文件,用于签名信息。然后,将 keystore.properties 放入 .gitignore

关于android - gradle属性中的正确配置键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45680769/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com