如何将 --minimal-main-dex 参数添加到 dx

How to add --minimal-main-dex argument to the dx

如何使主 dex 完全包含我提供的 类。即,如何将 --minimal-main-dex 参数传递给 dx?我尝试将 main_dex_list_opts = ["--minimal-main-dex"] 添加到 android_binary 规则,但它不起作用。非常感谢您的帮助!

我的 android_binary 规则:

android_binary(
    name="apk",
    custom_package = "com.xtbc",
    manifest_merger = "android",
    manifest = "AndroidManifest.xml",
    resource_files = glob(["res/**"], exclude=["res/.DS_Store"]),
    assets = glob(["assets/**"], exclude=["assets/.DS_Store"]),
    assets_dir = "assets",
    multidex = "manual_main_dex",
    main_dex_list = "mainDexClassList.txt",
    main_dex_list_opts = ["--minimal-main-dex"],
    dexopts = [
        "--force-jumbo"
    ],
    deps = [
        ":lib"
    ]
)

android_binarydexopts 属性可用于将标志传递给 dx。请参阅此处的文档:https://bazel.build/versions/master/docs/be/android.html#android_binary.dexopts

所以你可以使用 dexopts = ["--minimal-main-dex"].