Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
577 views
in Technique[技术] by (71.8m points)

Disable Manifest Merger in Android Gradle Build

I am using the new gradle android buildsystem.

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

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Edit: this is actually possible though indirectly, starting with 0.3

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
}

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...