Chong Lip Phang
Chong Lip Phang

Reputation: 9279

App won't start due to Facebook provider in Android Manifest

I am using Unity to create Android apps. The first app which uses Facebook SDK is working perfectly fine. Now when I tried to use Facebook SDK in creating another Android app, the app won't even start on an Android device.

The app will start if I were to remove this line from the Android Manifest:

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

However, in that case, Facebook Share and Invite won't work.

I tried changing "exported" to "false", and changing "authorities", but the app won't start too. There are a few posts about this issue in Stack Overflow here, but the solutions given won't solve my problem.

Here is my full Android Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" android:installLocation="preferExternal" android:versionCode="28" android:versionName="28">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  <uses-sdk android:minSdkVersion="15" />
  <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true" android:theme="@style/UnityThemeSelector">
    <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
      <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
    </activity>
    <activity android:name="com.facebook.unity.FBUnityLoginActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity android:name="com.facebook.unity.FBUnityDialogsActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity android:name="com.facebook.unity.FBUnityAppLinkActivity" android:exported="true" />
    <activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true" />
    <activity android:name="com.facebook.unity.FBUnityGameRequestActivity" />
    <activity android:name="com.facebook.unity.FBUnityCreateGameGroupActivity" />
    <activity android:name="com.facebook.unity.FBUnityJoinGameGroupActivity" />
    <activity android:name="com.facebook.unity.AppInviteDialogActivity" />
    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="fb1705814153052097" />
    <provider android:name="com.facebook.FacebookContentProvider" android:authorities="com.facebook.app.FacebookContentProvider1705814153052097" android:exported="true" />
  </application>
</manifest>

What should I do to incorporate Facebook features in my second app?

Upvotes: 0

Views: 1696

Answers (1)

Bhupat Bheda
Bhupat Bheda

Reputation: 1978

try this:

 <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="1705814153052097" />

instead of

<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="fb1705814153052097" />

remove "fb" from app_id in meta data tag

and activity declaration like below

<activity
            android:name=".Login"
            android:exported="true"
            android:screenOrientation="portrait"
            android:configChanges="orientation|screenSize|keyboardHidden">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="fb1705814153052097" />
            </intent-filter>
        </activity>

you need to add in your activity intent filter <data android:scheme="fb1705814153052097" />

Upvotes: 2

Related Questions