I'm having problem with manifest merger with duplicated receivers but the content is different. I use the following receivers for different API levels, had no issue so far until merger. Build fails due to merger which says
Element receiver#.receivers.UpdateReceiver duplicated with element declared at AndroidManifest.xml:124:9
I don't want to create another receiver and continue with this schema. Is there any way to disable merger for those situations or merge the receivers in one but with the option of enabling action with different intent?
<receiver
android:name=".receivers.UpdateReceiver"
android:enabled="@bool/is_api_below_12">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
<receiver
android:name=".receivers.UpdateReceiver"
android:enabled="@bool/is_api_12_and_above">
<intent-filter>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
You can find how I fixed your exact same issue in this answer. Basically I created another class, but I made it an static inner class to avoid creating another file to handle a common action.
perhaps you can set
in your build.gradle file and this worked fine in my project you can see more details here