安卓 Jetifier CI/CD

标签 android androidx bitrise android-jetifier

尝试在 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!):

  1. 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)

  2. 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.

  3. 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/

相关文章:

android - 如何缩进跨越多行的项目符号列表

android - 非法状态异常 : Fragment already added appears if a App was very long in the background

ios - UITesting的iOS模拟器位置

android - assemble 与 assembleDebug 与 assembleRelease 之间的区别

android - Android Jetpack Compose 是否支持工具栏小部件?

ios - 未找到签名证书 “iOS Development” - 使用 bitrise/FaSTLane 匹配构建应用程序版本

android - 在android中按后退按钮时转到应用程序屏幕

android - 公开从 bundle 接收的数据

androidx 数据绑定(bind)错误 : package android. support.constraint 不存在

android - 如何使用导航架构组件在应用栏中设置标题