Manifest Merger fails when 2 libraries want to use the same permission

200 Views Asked by At

We are currently trying to update our System to the newest Android Studio/Gradle Tools and are expieriencing some errors on the way.

We do have 2 libraries using the permission.C2D_MESSAGE, namely Firebase and XtremePush. The problem is, as soon as we want to build our application the Manifest Merger fails the build because he wasn't able to complete the merge with the error "No records found. (This is a bug in the manifest merger.)".

When we looked into the issue we found following definitions:

Firebase

<permission android:name="${applicationId}.permission.C2D_MESSAGE" 
            android:protectionLevel="signature"/>

<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE"/>

XtremePush

<permission
    android:name=".permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

<uses-permission android:name=".permission.C2D_MESSAGE" />

As both definitions are in external libraries, we are not able to set merging rules or change the manifest details. Also, both libraries are up to date as of today, so there seems to be no solution either on the respective developers side. Setting the permission in our manifest also did not change anything.

Thanks a lot!

2

There are 2 best solutions below

0
On BEST ANSWER

I solved the problem by first finding out which libraries do clash. For me it was XtremePush with the package name 'ie.imobile.extremepush' and Firebase with the package name 'com.google.firebase'.

Then i change my implementation to..

<permission
    android:name="${applicationId}.permission.C2D_MESSAGE"
    android:protectionLevel="signature"
    tools:overrideLibrary="com.google.firebase, ie.imobile.extremepush" />

<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE"
                 tools:overrideLibrary="com.google.firebase, ie.imobile.extremepush"/>

..so that my manifest would override both manifests, which were clashing and resulted in the merging issue. This was no problem as they both already were nearly identical in function.

2
On

In your Android Manifest file add:

<uses-sdk tools:overrideLibrary="com.example.firebase, com.example.xtremepush"/>