As per these instructions https://developers.facebook.com/docs/sharing/android I have implemented the Facebook ShareDialog to appear in my app but it\'s causing the followin
(hopefully someone at FB will read this)
In addition to the (correct) advice given by Gokhan Caglar, also note this: Do not write the app-id number directly into AndroidManifest.xml! For FB to work, app-id must also be defined properly according to best practice in the file strings.xml
Because the app-id is also used under the provider tag, but there directly as the number, I did the shortcut of writing the app-id number directly into the meta-data tag as well. Huge mistake, 2 days gone.
As it seems, FB will make use of app-id fetched from both AndroidManifest.xml and directly based on the definitions in strings.xml. Both must be there. app-id must be defined in strings.xml. This solved the issue.
For FB development team, a couple of suggestions that will save people’s time:
Either remove this over-stringent use of app-id, or explain in the tutorial that this is the only way. (It is more stringent than Android itself)
Make a better error reporting system as overlay when the app definitions are not proper. A null exception like this deep within FB soon becomes your time thief of the day. In this case, an error report of the type: ”Error: app-id not defined in strings.xml” would have been satisfactory.
Regarding the tutorial, it contains a trap also, and so I mention it: If you run the tutorial here: https://developers.facebook.com/quickstarts/?platform=android, after you have already inserted key hash for development, something you would easily do if things aren’t working, then be aware that this tutorial will delete (or rather replace) vital info in the app definition without telling you about it. Since you have perhaps already defined the keyhash, you do not fill it in once again in this quickstart guide. Hence, later you discover that the keyhash is gone and wonder why.
do not write the facebook key within the meta
write it in a string and reference it in the meta in manifest
like so
<string name="id_facebook">id_facebook</string>
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/id_facebook" />
hope this helps :)
You also need to add the application id like this:
<application android:label="@string/app_name" ...>
...
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
...
</application>