dar*_*eck 1 android facebook facebook-android-sdk
我正在努力将Facebook sdks与我的Android应用程序集成.我想要做的就是利用sdk的共享功能.
我收到以下错误:
我目前已将我的gradle配置为编译'com.facebook.android:facebook-android-sdk:3.21.1'
String.xml
<string name="app_name">TestApp</string>
<string name="facebook_app_id">123456789</string>
Run Code Online (Sandbox Code Playgroud)
在我的AndroidManifest中:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<application
android:allowBackup="true"
android:icon="@drawable/mtr_icon"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name="com.test.Application"
android:hardwareAccelerated="true">
<activity
android:name="com.test.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>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
<activity android:name="com.facebook.LoginActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:label="@string/app_name" />
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
分享代码:
// Publish the post using the Share Dialog
FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(_activity)
.setApplicationName("TestApp")
.build();
Run Code Online (Sandbox Code Playgroud)
在实际的Facebook仪表板中:
- Google Play Package Name = com.test
- Class Name = com.test.MainActivity
- Display Name = TestApp
- App ID = 123456789
- Also added the keyHashes to the keystore that is used to sign the generated apt
Run Code Online (Sandbox Code Playgroud)
注意:TestApp在Facebook仪表板中声明"此应用程序处于开发模式".
当我运行应用程序时,我在尝试共享信息并获得异常时收到错误:
Error: com.facebook.FacebookException: Failed to authenticate the application because of app name mismatch. Please check the application name configured by the dialog.
我按照这里的说明操作:https://developers.facebook.com/docs/android/getting-started#maven
任何建议赞赏!谢谢,德里克
| 归档时间: |
|
| 查看次数: |
3535 次 |
| 最近记录: |