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

一曲冷凌霜 提交于 2020-01-04 13:39:09

问题


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

"Failed to authenticate the application because of app name mismatch. Please check the application name configured by the dialog."

After reading many posts on this subject, from other people getting the same issue and succeeded in correcting it, it's still impossible for me to get the Facebook SDK working… I suppose there is something wrong between the app configuration on Facebook and my Android project, but I don't understand what.

This is my application configuration on Facebook :

  • App ID : 752068304844308
  • Display name : TestFSdk
  • namespace : lbptestfsdk

The configuration for Android on Facebook :

  • Package name : fr.laposte.testfsdk
  • Class name : fr.laposte.testfsdk.MainActivity
  • Key hash : the one i get with key tool + openssl (android debug key)
  • Single Sign On : yes
  • Deep Linking : no

And my Android project :

  • Eclipse project name : TestFSdk (is it important ?)
  • Activity class using FB SDK : fr.laposte.testfsdk.MainActivity
  • strings.xml contains :

    <string name="app_id">752068304844308</string>
    <string name="app_name">TestFSdk</string>     --> is it usefull ?
    
  • AndroidManifest.xml :

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="fr.laposte.testfsdk"
        android:versionCode="1"
        android:versionName="1.0" >
        <uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="19" />
        <uses-permission android:name="android.permission.INTERNET" />
        <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/AppTheme">
            <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id"/>
            <activity
                android:name="fr.laposte.testfsdk.MainActivity"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <activity
                android:name="com.facebook.LoginActivity"
                android:theme="@android:style/Theme.Translucent.NoTitleBar"
                android:label="@string/app_name" />
        </application>
    </manifest>
    

Do you see something wrong ?

Thank you for your help.


回答1:


Please check name in app(in your manifest file) and name of application on facebook().




回答2:


I had a similar issue. I was using SetApplicationName() in the ShareDialogBuilder to set a name that was different to the facebook Display Name. They must match!




回答3:


According to documents https://developers.facebook.com/docs/android/share?locale=es_ES

and add

.setApplicationName("Display Name")



来源:https://stackoverflow.com/questions/23660062/android-facebook-sdk-failed-to-authenticate-the-application-because-of-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!