Xamarin aar bindings and provider in library

lassanalassana BYMember ✭✭
edited January 2017 in Xamarin.Android

Hello

I'm trying to create bindings for Zendesk library and I faced with a problem.

Zendesk Belvedere library (belvedere-1.0.2.1.aar) contains a file provider in its manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    ...
    ...

    <application>
        <provider
            android:name="com.zendesk.belvedere.BelvedereFileProvider"
            android:authorities="${applicationId}.belvedere.attachments"
            android:exported="false"
            android:grantUriPermissions="true" >
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/belvedere_attachment_storage" />
        </provider>
    </application>

</manifest>

When Gradle is used as build tool, it puts this aar to the APK file and it replaces ${applicationId}.belvedere.attachments with com.your_package_name_here.belvedere.attachments in the merged manifest file. It's fine.

However, Xamarin handles it different. Here is what I found in the manifest of my final APK:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    ...
    ...

    <application 
        ...
        ...
        <provider 
            android:name="com.zendesk.belvedere.BelvedereFileProvider" 
            android:exported="false"
            android:authorities="dollar_openBracket_applicationId_closeBracket" 
            android:grantUriPermissions="true">
            <meta-data 
                android:name="android.support.FILE_PROVIDER_PATHS" 
                android:resource="@xml/belvedere_attachment_storage" />
        </provider>
        ...
        ...
    </application>
</manifest>

Obviously, dollar openBracket_applicationId_closeBracket is not what I need.

Seems everything works, however it makes impossible to install several Xamarin applications that use these bindings, because all of them would have conflicting providers with the same authority (and user would get INSTALL_FAILED_CONFLICTING_PROVIDER error).

Is there a way to change dollar_openBracket_applicationId_closeBracket in the manifest?

Sign In or Register to comment.