Search code examples
androidfacebookfacebook-graph-apifacebook-android-sdkfacebook-share

Facebook + Android: Failed to authenticate the application because of app name mismatch


While trying to use Facebook SDK on my Android App, I got this error:

"03-12 17:53:27.607: E/Activity(27797): Error: com.facebook.FacebookException: Failed to authenticate the application because of app name mismatch. Please check the application name configured by the dialog."

I have already read all the post about this issue checked my app setting in Facebook as well as in my app but nothing is resolving this issue.

These are the links I have already followed

Android + Facebook SDK : "Failed to authenticate the application because of app name mismatch."

Android - Facebook connectivity fails

These are the setting in my Facebook dashboard

  • Display name: Abc Def
  • Namespace: blank (nothing is filled here)
  • Google Play Package Name: com.xyz.abcdef
  • Class name: GameAcivity
  • Keyhash: it has been put there(if that has been an issue logcat would have shown it as keyhash issue)
  • Single sign on is enabled (But I am not asking user to login just for the share dialog as it is not required according to FB documentation)

I am trying to use this share dialog on my own device with my own Facebook account which is the administrator of the app as well.

In my Project:

  • Project name: AbdDef
  • app_name: Abd Def (in android manifest)

And this is the code I am using:

FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this)
            .setLink("https://developers.facebook.com/android")
            .setApplicationName("Abc Def")
            .build();
uiHelper.trackPendingDialogCall(shareDialog.present());

I have carefully watched over caps as well as spaces. Can someone point out if I am doing something wrong. It would be a great help.


Solution

  • You need to add the "com.facebook.sdk.ApplicationId" as a meta-data element in your AndroidManifest.xml, and then set the "facebook_app_id" in your strings.xml file.

    See the last steps here: developers.facebook.com/docs/android/