Glad to hear that there is some work going on for this. I ran into a similar issue related to the manifest merging that took me a bit to figure out how to eventually get it to work (it is definitely not ideal).
Basically, the issue I was running into was that I wanted to be able to vary the attributes of my <application /> tag based on my Product Flavor. Although there are easy ways to change the contents of the <application /> tag I haven't found any that would allow me to change out the attributes without some creative thinking. To set it up, I am trying to do this following: src/main/AndroidManifest.xml > <manifest package="com.my.package"> > <application/> > </manifest> src/flavor1/AndroidManifest.xml > <manifest xmlns:android="http://schemas.android.com/apk/res/android" > package="com.my.package.flavor1"> > <application > android:name="com.my.package.flavor1.Flavor1Application"> > ... > </application> > </manifest> src/flavor2/AndroidManfiest.xml > <manifest xmlns:android="http://schemas.android.com/apk/res/android" > package="com.my.package.flavor2"> > <application > android:name="com.my.package.flavor2.Flavor2Application"> > ... > </application> > </manifest> What this results in when the manifests are merged is an empty application tag every time. Other attributes (icon for example) also are not merged properly when this happens. In order to make this work so that I could have different attributes for the application tag used I ended up having to disable the processManifest task and manually override the processResources.manfiestFile value (as shown below). > applicationVariants.all { variant -> > variant.processResources.manifestFile = > file("src/${variant.flavorName}/AndroidManifest.xml") > variant.processManifest.enabled=false > } It would definitely be great to have manifest merging actually merge instead of selectively merging certain elements (as it seems to be doing now). On Tuesday, February 25, 2014 12:30:47 PM UTC-5, Xavier Ducrohet wrote: > > I'm not sure this is fully working. We're working on a brand new one with > a lot of control and we'll have it all documented. Stay tuned. > > > On Tue, Feb 25, 2014 at 12:06 AM, Paul Peavyhouse > <[email protected]<javascript:> > > wrote: > >> There seems to be some form of manifest merging control in the merge tool >> that support tools:merge="override|remove". >> >> To use, declare the header of your manifest as follows: >> >> <manifest xmlns:android="http://schemas.android.com/apk/res/android" >> xmlns:tools="http://schemas.android.com/tools"> >> >> Then, use one of the following appropriate attributes on any activity, >> activity-alias, service, receiver, or provider element that you want to >> merge: >> >> tools:merge="override" >> tools:merge="remove" >> >> This info was gleaned from: >> >> https://android.googlesource.com/platform/tools/base/+/idea133/build-system/manifest-merger/src/main/java/com/android/manifmerger/ManifestMerger.java >> Pv >> >> On Monday, January 27, 2014 10:55:02 AM UTC-8, Xavier Ducrohet wrote: >> >>> Something like that. I think we'd have to make lint able to detect that >>> you are using a library project with a higher minSdkVersion and have it >>> output warning. >>> >>> >>> On Mon, Jan 27, 2014 at 10:31 AM, Malachi de AElfweald < >>> [email protected]> wrote: >>> >>>> That'd be interesting. I guess you would want to put some >>>> SDK.VERSION checks around calls to that library? >>>> >>>> >>>> On Mon, Jan 27, 2014 at 10:28 AM, Jake Wharton <[email protected]>wrote: >>>> >>>>> Well that’s up to the tools team but I presume it’d be on the DSL >>>>> somewhere. >>>>> >>>>> Random strawman example: >>>>> >>>>> compile('com.foo:bar:1.2.3') { >>>>> ignoreMinSdk true >>>>> } >>>>> >>>>> >>>>> >>>>> --- >>>>> Jake Wharton >>>>> http://about.me/jakewharton >>>>> >>>>> >>>>> On Mon, Jan 27, 2014 at 10:24 AM, Malachi de AElfweald < >>>>> [email protected]> wrote: >>>>> >>>>>> How would you do the "explicitly acknowledge and opt-out" per library? >>>>>> >>>>>> >>>>>> On Mon, Jan 27, 2014 at 10:23 AM, Jake Wharton <[email protected]>wrote: >>>>>> >>>>>>> I'd say that the build should fail unless you explicitly acknowledge >>>>>>> and opt-out of the sanity check on a per-library basis in your build >>>>>>> file. >>>>>>> >>>>>>> There's no reason you can't use a library with a minSdkVersion >>>>>>> higher than yours so long as you do it carefully. It's the same with >>>>>>> using >>>>>>> platform APIs that are newer than your minimum. >>>>>>> >>>>>>> >>>>>>> --- >>>>>>> Jake Wharton >>>>>>> http://about.me/jakewharton >>>>>>> >>>>>>> >>>>>>> On Mon, Jan 27, 2014 at 10:18 AM, Malachi de AElfweald < >>>>>>> [email protected]> wrote: >>>>>>> >>>>>>>> So if I declare minSdk as 10 in my application; but depend on a >>>>>>>> 3rd party library that says minSdk is 11... What is the recommended >>>>>>>> solution? >>>>>>>> It seems that the best option would be to force the build to be >>>>>>>> minSdk 11 and explain why in the logs -- rather than preventing the >>>>>>>> use of >>>>>>>> the 3rd party library? >>>>>>>> >>>>>>>> >>>>>>>> On Mon, Jan 27, 2014 at 10:05 AM, Xavier Ducrohet <[email protected] >>>>>>>> > wrote: >>>>>>>> >>>>>>>>> The minSdkVersion should always be the one declared in the app, >>>>>>>>> and all libraries should be equals or lesser then the app one. >>>>>>>>> >>>>>>>>> Formatting/Order, yes we should fix it to make it work better. >>>>>>>>> >>>>>>>>> >>>>>>>>> On Mon, Jan 27, 2014 at 10:01 AM, Malachi de AElfweald < >>>>>>>>> [email protected]> wrote: >>>>>>>>> >>>>>>>>>> Another area to address with the manifest merging might be >>>>>>>>>> max(minSdk) of all the libraries? >>>>>>>>>> >>>>>>>>>> Or making sure that things are grouped (permissions at the top, >>>>>>>>>> for example) rather than intermixed when there are multiple >>>>>>>>>> libraries...? >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Mon, Jan 27, 2014 at 9:54 AM, Xavier Ducrohet < >>>>>>>>>> [email protected]> wrote: >>>>>>>>>> >>>>>>>>>>> Not at the moment, but this is something we want to do. I'm >>>>>>>>>>> currently writing a spec for it actually. Work on it should start >>>>>>>>>>> in a few >>>>>>>>>>> weeks I think, as we realize that the current merger shows some big >>>>>>>>>>> limitations. >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> On Mon, Jan 27, 2014 at 3:56 AM, Roman Mazur <[email protected] >>>>>>>>>>> > wrote: >>>>>>>>>>> >>>>>>>>>>>> Does Android Gradle plugin provide any instruments for >>>>>>>>>>>> controlling how manifest is merged? >>>>>>>>>>>> Particularly I'm interested whether there is a way to exclude >>>>>>>>>>>> some components declared in libraries from the final manifest. >>>>>>>>>>>> >>>>>>>>>>>> -- >>>>>>>>>>>> You received this message because you are subscribed to the >>>>>>>>>>>> Google Groups "adt-dev" group. >>>>>>>>>>>> To unsubscribe from this group and stop receiving emails from >>>>>>>>>>>> it, send an email to [email protected]. >>>>>>>>>>>> >>>>>>>>>>>> For more options, visit https://groups.google.com/ >>>>>>>>>>>> groups/opt_out. >>>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> -- >>>>>>>>>>> Xavier Ducrohet >>>>>>>>>>> Android SDK Tech Lead >>>>>>>>>>> Google Inc. >>>>>>>>>>> http://developer.android.com | http://tools.android.com >>>>>>>>>>> >>>>>>>>>>> Please do not send me questions directly. Thanks! >>>>>>>>>>> >>>>>>>>>>> -- >>>>>>>>>>> You received this message because you are subscribed to the >>>>>>>>>>> Google Groups "adt-dev" group. >>>>>>>>>>> To unsubscribe from this group and stop receiving emails from >>>>>>>>>>> it, send an email to [email protected]. >>>>>>>>>>> >>>>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out >>>>>>>>>>> . >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> >>>>>>>>>> Thank you, >>>>>>>>>> Malachi de Ælfweald | Sr. SDK Developer | Kontagent-Playhaven >>>>>>>>>> Mobile: +1 503-307-1597 >>>>>>>>>> Skype: malachid69 | Find me on >>>>>>>>>> LinkedIn<http://www.linkedin.com/in/malachid/> >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> You received this message because you are subscribed to the >>>>>>>>>> Google Groups "adt-dev" group. >>>>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>>>> send an email to [email protected]. >>>>>>>>>> >>>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Xavier Ducrohet >>>>>>>>> Android SDK Tech Lead >>>>>>>>> Google Inc. >>>>>>>>> http://developer.android.com | http://tools.android.com >>>>>>>>> >>>>>>>>> Please do not send me questions directly. Thanks! >>>>>>>>> >>>>>>>>> -- >>>>>>>>> You received this message because you are subscribed to the Google >>>>>>>>> Groups "adt-dev" group. >>>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>>> send an email to [email protected]. >>>>>>>>> >>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> >>>>>>>> Thank you, >>>>>>>> Malachi de Ælfweald | Sr. SDK Developer | Kontagent-Playhaven >>>>>>>> Mobile: +1 503-307-1597 >>>>>>>> Skype: malachid69 | Find me on >>>>>>>> LinkedIn<http://www.linkedin.com/in/malachid/> >>>>>>>> >>>>>>>> -- >>>>>>>> You received this message because you are subscribed to the Google >>>>>>>> Groups "adt-dev" group. >>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>> send an email to [email protected]. >>>>>>>> >>>>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>>>> >>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "adt-dev" group. >>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>> send an email to [email protected]. >>>>>>> >>>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> >>>>>> Thank you, >>>>>> Malachi de Ælfweald | Sr. SDK Developer | Kontagent-Playhaven >>>>>> Mobile: +1 503-307-1597 >>>>>> Skype: malachid69 | Find me on >>>>>> LinkedIn<http://www.linkedin.com/in/malachid/> >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "adt-dev" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to [email protected]. >>>>>> >>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>> >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "adt-dev" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> >>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>> >>>> >>>> >>>> >>>> -- >>>> >>>> Thank you, >>>> Malachi de Ælfweald | Sr. SDK Developer | Kontagent-Playhaven >>>> Mobile: +1 503-307-1597 >>>> Skype: malachid69 | Find me on >>>> LinkedIn<http://www.linkedin.com/in/malachid/> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "adt-dev" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>> >>> >>> >>> -- >>> Xavier Ducrohet >>> Android SDK Tech Lead >>> Google Inc. >>> http://developer.android.com | http://tools.android.com >>> >>> Please do not send me questions directly. Thanks! >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "adt-dev" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > > > -- > Xavier Ducrohet > Android SDK Tech Lead > Google Inc. > http://developer.android.com | http://tools.android.com > > Please do not send me questions directly. Thanks! > -- You received this message because you are subscribed to the Google Groups "adt-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
