bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.24k stars 4.08k forks source link

bazel doesn't merge all the AndroidManifest.xml #2919

Closed ldjhust closed 7 years ago

ldjhust commented 7 years ago

Hi guys, my android project contains some module, and each module has its own AndroidManifest.xml, I have already set the manifest_merger = "android" in android_binary rule, but the module's AndroidManifest.xml looks like still doesn't in the final AndroidManifest.xml.

So, what's the problem here? Thanks very much for any help!

My android_binary rule:

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 = "mainDexList.txt",
    dexopts = [
        "--force-jumbo"
    ],
    deps = [
        ":lib",
        ":base_lib",
        ":jni"
    ]
)

The :base_lib is a module (ie, an android_library rule), and it has its own AndoridManifest.xml, but the final AndroidManifest.xml doesn't contain its contents.

aj-michael commented 7 years ago

Hi @ldjhust , to export the AndroidManifest.xml from the android_library, set exports_manifest = 1 on the android_library. Note that in the next Bazel release, the default value of exports_manifest will change from 0 to 1, so it will no longer be required to explicitly set it.

Sorry for the confusion!

ldjhust commented 7 years ago

OK, Thanks very much!