本文介绍了禁用清单合并在Android的摇篮构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在用的是新的摇篮的Andr​​oid构建系统。

I am using the new gradle android buildsystem.

该项目由两个机器人库项目和一个主要项目。

The project consists of two android library projects and one main project.

使用Ant构建,清单合并必须启用project.properties。但使用摇篮构建系统时,清单合并默认情况下启用。如何禁用清单合并?

Using the ant build, the manifest merger must be enable in project.properties. But when using the gradle build system the manifest merger is enabled by default. How can i disable the manifest merger?

推荐答案

编辑:其实这是可能的,虽然间接,从0.3

this is actually possible though indirectly, starting with 0.3

您需要做的是禁用processManifest任务,以便它不运行,并告诉processResources什么地方清单以使用为:

What you need to do is disable the processManifest task so that it doesn't run and tell the processResources where the manifest to use is:

android.applicationVariants.all { variant ->
    variant.processResources.manifestFile = file('src/main/AndroidManifest.xml')
    variant.processManifest.enabled=false
}

请注意,如果您是通过DSL定制的应用程序包的名字,你应该保持缺省清单不变的默认位置在R类提供一个一致的包名,然后有你的手工合并体现在其他地方和点每个变种processResources任务给他们。

Note that if you are customizing the app package name through the DSL, you should keep the default manifest untouched in the default location to provide a consistent package name for the R classes, and then have your manually merged manifests somewhere else and point each variant processResources task to them.

这篇关于禁用清单合并在Android的摇篮构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 03:29