Skip to content Skip to sidebar Skip to footer

Manifest Merger Error When Using Dynamic Features And Build Flavors

With dynamic-feature-modules it is possible to define in the AndroidManifest.xml wheter a module should come preinstalled:

Solution 1:

This answer worked for me. The idea is to have two copies of the AndroidManifest.xml, which are identical except

<dist:module
    ...
    tools:node="replace"
    dist:onDemand="false">
    ...
</dist:module>

which replaces the whole element.

Solution 2:

The manifest merger tool combines all XML elements from each file by following some merge heuristics. If the merger tool finds that both manifests contain the same attribute with different values, then a merge conflict occurs.

Docs: https://developer.android.com/studio/build/manifest-merge

Solution 3:

To expand on celaeno's answer

If I tried to have just debug and release (or whatever your two build types are) AndroidManifests that were full and exact copies except changes to dist:onDemand line. This didnt' work. Gradle yelled at me about a missing src/main/AndroidManifest.xml. So I actually created three files:

  1. main
<manifestxmlns:android="http://schemas.android.com/apk/res/android"xmlns:dist="http://schemas.android.com/apk/distribution"package="com.example.somefeature"><application...><activityandroid:name=...
        </activity></application><!-- NO dist:module block --></manifest>
  1. debug

    <dist:moduledist:instant="false"dist:title="@string/somefeature">
        <dist:delivery><dist:install-time /></dist:delivery><dist:fusingdist:include="true" />
    </dist:module>
    

  2. release

    <dist:moduledist:instant="false"dist:title="@string/somefeature">
        <dist:delivery><dist:on-demand /></dist:delivery><dist:fusingdist:include="true" />
    </dist:module>
    

Post a Comment for "Manifest Merger Error When Using Dynamic Features And Build Flavors"