INSTALL_FAILED_CONFLICTING_PROVIDER Xamarin Android

thangvuthangvu VNMember ✭✭

My situation is that I have 2 separate applications, both of which integrated with Facebook SDK. Both of them have different authorities that are declared in the AndroidManifest file: (they are using 2 different Facebook apps too)

<provider android:authorities="com.facebook.app.FacebookContentProvider[facebookAppId01]" android:name="com.facebook.FacebookContentProvider" android:exported="true" />
and

<provider android:authorities="com.facebook.app.FacebookContentProvider[facebookAppId02]" android:name="com.facebook.FacebookContentProvider" android:exported="true" />

It seems that according to the documentation from Facebook, I've done it right when declaring 2 different ContentProviders for 2 apps. But when I deployed it, this error appeared:

1>An error occurred. See full exception on logs for more details.
1>Failure [INSTALL_FAILED_CONFLICTING_PROVIDER]

If I install the app01 first, I cannot install the app02. Same when I install the app02 first, I cannot install the app01.

How can I solve that?

Thanks in advantage.

Best Answers

  • thangvuthangvu VN ✭✭
    Accepted Answer

    SOLVED: I solved this problem by downgrading the SDK to version 4.16.1. Worked perfectly like a charm. Thanks for all the help.

Answers

  • grierosualina.0064grierosualina.0064 ROMember ✭✭

    Hi,

    I have the same problem. But the issue seems to be from another place. If you open the AndroidManifest.xml file after the build (obj/Debug/android/). You can see there some strange providers:

    <!--
         The initialization ContentProvider will call FacebookSdk.sdkInitialize automatically
         with the application context. This config is merged in with the host app's manifest,
         but there can only be one provider with the same authority activated at any given
         point; so if the end user has two or more different apps that use Facebook SDK, only the
         first one will be able to use the provider. To work around this problem, we use the
         following placeholder in the authority to identify each host application as if it was
         a completely different provider.
        -->
    <provider android:name="com.facebook.internal.FacebookInitProvider" android:authorities="dollar_openBracket_applicationId_closeBracket" android:exported="false" />
    

    In my Manifest it appears twice: android:authorities="dollar_openBracket_applicationId_closeBracket".

  • thangvuthangvu VNMember ✭✭

    @grierosualina.0064

    Hi there,
    Thank you for this information. I've also found this earlier yesterday. But It doesn't seem very helpful for me. Have you found any solution?

  • khoanguyenvankhoanguyenvan USMember ✭✭

    do any help? I'm currently face with this problem :(

  • thangvuthangvu VNMember ✭✭
    edited May 2017

    Additional information: I downloaded the sample project from Facebook SDK (HelloFacebookSample) and tried to deploy it on the same device. Still, the same error occurred. Any solution folks?

  • thangvuthangvu VNMember ✭✭
    edited June 2017

    Well, I think at least I've found the root cause of the problem. Because Facebook SDK is initialized through the Manifest's provider, so when it comes to deployment, Xamarin will generate an automatic Manifest file, in which we will found the following provider:
    <provider android:name="com.facebook.internal.FacebookInitProvider" android:authorities="dollar_openBracket_applicationId_closeBracket" android:exported="false" />. It contains dollar_openBracket_applicationId_closeBracket rather than ${applicationId}when we deploy from Android Studio. This will cause a conflict between apps that use providers, make them cannot be installed or deployed on the same device. I don't know if there are any fixes for this problem (yet) :(

  • thangvuthangvu VNMember ✭✭
    Accepted Answer

    SOLVED: I solved this problem by downgrading the SDK to version 4.16.1. Worked perfectly like a charm. Thanks for all the help.

  • fx14fx14 USMember

    thanks. same for me. updating Xamarin.Facebook.Android to version 4.24.0 solved this issue. it required a clean/rebuild, but works perfectly now.

  • thangvuthangvu VNMember ✭✭

    @RafaeldeAndrade said:

    @thangvu said:
    SOLVED: I solved this problem by downgrading the SDK to version 4.16.1. Worked perfectly like a charm. Thanks for all the help.

    The version 4.24.0 was released and it's working without problems!

    Cheers!

  • DooksDooks ZAMember ✭✭✭

    I found the same with Crashlytics:

    <provider
        android:name="com.crashlytics.android.CrashlyticsInitProvider" 
        android:authorities="dollar_openBracket_applicationId_closeBracket"
        android:exported="false"
        android:initOrder="100" />
    

    Way around it is:
    1. Rebuild your project
    2. Go to obj/[debug|release]/90/lp/
    3. In the lp folder there are folders 0, 1, 2, 3, etc. - find the folder with Fabric AndroidManifest.xml which looks like this (In my case it was 28):

    4. In aapt there is another AndroidManifest.xml file which looks like this:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.crashlytics.android" android:versionCode="1" android:versionName="2.9.4">
        <uses-sdk android:minSdkVersion="9" />
        <uses-permission android:name="android.permission.INTERNET" />
    
        <application>
            <provider android:name="com.crashlytics.android.CrashlyticsInitProvider" android:authorities="dollar_openBracket_applicationId_closeBracket" android:exported="false" android:initOrder="100" />
        </application>
    
    </manifest>
    
    1. Remove the entire <application .... </application> tag and save.
    2. Build/Archive Project (NOT Rebuild!!)
    3. Success, the dollar_openBracket_applicationId_closeBracket line is gone
Sign In or Register to comment.