尝试在 CI/CD 环境中使用 Jetifier,特别是对我来说,我使用的是 bitrise,但真正的问题是我想自动化部署过程。在 AndroidX 之前这工作正常,现在我需要一种通过命令行为整个应用程序使用 jetifier 的方法。我已经进入了使用 exclude
摆脱所有可以想象的依赖项的兔子洞,但是 enableJetifier=true
什么都不做,除非你从 Android Studio 构建。我是否缺少在过去 2 周的谷歌搜索中没有找到的 gradle 插件?或者这是一个 Unresolved 问题?
最佳答案
我在使用 Jenkins/FaSTLane 时遇到了同样的问题。出于安全原因,gradle.properties
不应位于存储库中 enableJetifier=true
环境变量将对任务不可见。
解决方案是将 properties
添加到 gradle FaSTLane 任务中:
desc "Create a release build"
lane :release do
remove_apk
gradle(
task: "assembleRelease",
properties: {
"android.enableJetifier" => "true",
"android.useAndroidX" => "true"
}
)
end
我不熟悉 bitrise,但是这个链接可能有助于设置 settings/environment variables对于比特币。
In general the solutions (might be others too, if anyone have any additional note just let us know!):
Use a secondary repository to store your secrets in, and git clone that with a Script step for example (if you’d want to do this please make sure that the same SSH key can be used for both repos! 11)
Use App Env Vars or Secret Env Vars on bitrise.io 37 - you can find these in the Workflow Editor (Workflow tab of your app on bitrise.io 37). The variables you define here are regular environment variables, so you can use them any way you like, e.g. with a Script step, writing into a file.
Use the Generic File Storage 63 feature of bitrise.io 37, upload your file(s) and download it using the File Downloader or ZIP resource archive downloader step.
These are just the highlights of the main solutions of course, there are other possible ways if you’re more adventurous, e.g. store the file encrypted in your repository, store the encryption key in an App Env Var or Secret Env Var on bitrise.io 37 and decrypt the file during the build.
同时检查:https://devcenter.bitrise.io/builds/env-vars-secret-env-vars/
关于安卓 Jetifier CI/CD,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56485007/