Here is a little detail about my app. I have a tab layout using Fragments
and a ViewPager
. On the third tab, I have a Google Map V2. Now, whenever
You cannot put the appID directly into the manifest itself, you need to reference a string resource in the manifest. Something like:
In your AndroidManifest:
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id"/>
In your strings.xml
<resources>
...
<string name="app_id">$app_id_here</string>
</resources>
Shouldn't that actually be:
<meta-data android:name="com.facebook.sdk.ApplicationId" android:resource="@string/app_id"/>
Note the change from android:value to android:resource.
It is important to bear in mind that you have to paste the meta-data element WITHIN THE APPLICATION TAGS.
This way:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id"/>
</application>
If you paste it somewhere else, you will keep getting this error.
Incase anyone is still having problems with this, here's the solution I found:
I was still getting a manifest merge error when I made these changes. I noticed that if I changed android:value to android:resource, I could fire off the app but it would still crash when I tried to launch facebook. I found the solution while in the "Merged Manifest" tab at the bottom of the screen when looking at the android Manifest.xml. Code as follows:
<meta-data
android:name="com.facebook.sdk.ApplicationId"
tools:replace="android:value"
android:value="@string/facebook_app_id" />
Notice the tools:replace="android:value"
comes before android:value
This is important for the flow and fixed my problem.
Hope this helps!