0

I am creating multiple white-label apps on Android.

Each of these apps use the same Facebook login.

According to the docs: https://developers.facebook.com/docs/sharing/android

I need to add:

<provider android:authorities="com.facebook.app.FacebookContentProvider{APP_ID}"
          android:name="com.facebook.FacebookContentProvider"
          android:exported="true"/>

The issue is that we get a conflict error when attempting to use the same app multiple times: INSTALL_FAILED_CONFLICTING_PROVIDER as described here: Android Facebook content provider authority

How can I solve this issue? Note that I tried to set android:exported to false but it did not seem to work.

Yahya Uddin
  • 26,997
  • 35
  • 140
  • 231

1 Answers1

0

Try to use ${APP_ID} instead of {APP_ID}. It works fine for us:

<application>
    <provider
        android:name="company.name.utils.SDKInitProvider"
        android:authorities="${APP_ID}.sdk.SDKInitProvider"
        android:exported="false" />
</application>

$applicationId is defined differently on every product flavour:

defaultConfig {
    APP_ID "some.namespace.of"
    minSdkVersion 18
    targetSdkVersion 29
    ...
}
Simon
  • 1,657
  • 11
  • 16
  • The Facebook SDK says it has to `android:authorities="com.facebook.app.FacebookContentProvider{APP_ID}"`. `APP_ID` is referreing the FB ID. Are you saying I can change this to anything i want and the FB SDK would still work? – Yahya Uddin Jun 01 '20 at 17:07
  • Try to add $ before the opening curly bracket. It needs to be a variable: android:authorities="com.facebook.app.FacebookContentProvider${APP_ID}" – Simon Jun 02 '20 at 05:15
  • Check all the providers in the AndroidManifest and make them change dynamically too as much as possible. If you have search provider as in https://developer.android.com/reference/android/content/SearchRecentSuggestionsProvider#constants then make changes to the authority too – Tonui Nicholus Jun 02 '20 at 11:47