Sromku facebook登录问题



我正试图使用SimpleFacebookSDK登录并在墙上共享一些东西,但这似乎是不可能的,因为我在logCat:中得到了这一点

09-11 16:08:30.836: E/ActivityThread(12092): Failed to find provider info for com.facebook.katana.provider.AttributionIdProvider
09-11 16:08:30.876: E/com.facebook.LoginActivity(12092): Cannot call LoginActivity with a null calling package. This can occur if the launchMode of the caller is singleInstance.

这是我的清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.masterdetailsexample"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="21" />
    <application
        android:allowBackup="true"
        android:hardwareAccelerated="false"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:theme="@style/CustomActionBarTheme" >
        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/app_id" />
        <activity
            android:name="com.example.masterdetailsexample.Splash"
            android:label="@string/app_name"
            android:launchMode="singleTop" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.example.masterdetailsexample.CircleListActivity"
            android:label="@string/app_name" />
        <activity
            android:name="com.example.masterdetailsexample.Main"
            android:label="@string/app_name"
            android:launchMode="singleInstance"
            android:theme="@style/CustomActionBarTheme" />
        <activity
            android:name="com.example.masterdetailsexample.Details"
            android:label="@string/app_name"
            android:launchMode="singleInstance"
            android:theme="@style/CustomActionBarTheme" />
        <activity
            android:name="com.example.masterdetailsexample.TestSearch"
            android:label="@string/app_name"
            android:theme="@style/CustomActionBarTheme" />
        <activity
            android:name="com.example.masterdetailsexample.FavoritesActivity"
            android:theme="@style/CustomActionBarTheme" />
        <activity
            android:name="com.example.masterdetailsexample.Overlay"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />
        <activity
            android:name="com.example.masterdetailsexample.FullScreenBanner"
            android:theme="@android:style/Theme.NoTitleBar" />
        <activity
            android:name="com.example.masterdetailsexample.DevicesIntro"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />
        <activity
            android:name="com.example.masterdetailsexample.CircleDetailActivity"
            android:label="Circle detail" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".CircleListActivity" />
        </activity>
        <activity
            android:name="com.facebook.LoginActivity"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />
        <!--
        <receiver android:name="com.example.masterdetailsexample.NetworkStateReceiver" >
            <intent-filter>
                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
            </intent-filter>
        </receiver>
        -->
    </application>
</manifest>

有人知道这里的问题是什么吗?

检查清单中fb应用程序和应用程序id的哈希键

  1. 打开https://developers.facebook.com/
  2. 注册为开发人员
  3. 添加新应用
  4. 打开仪表板,在其中可以找到应用程序ID
  5. 在AndroidManifest.xml 中添加应用程序ID

        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="**App ID**"
        />
    

  6. 打开设置并添加您的电子邮件

  7. 添加平台+添加平台并选择Android
  8. 从AndroidManifest.xml添加包名
  9. 对于哈希密钥,请使用"keytool":

    keytool-exportcert-alias-keystore|openssl sha1-binary|openssl base64

或者以编程方式:

public void printHashKey() {
   try {
      PackageInfo info = getActivity().getPackageManager().getPackageInfo("com.gorbin.androidsocialnetworksextended.asne",
      PackageManager.GET_SIGNATURES);
      for (Signature signature : info.signatures) {
         MessageDigest md = MessageDigest.getInstance("SHA");
         md.update(signature.toByteArray());
         Log.d("HASH KEY:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
      }
   } catch (PackageManager.NameNotFoundException e) {
   } catch (NoSuchAlgorithmException e) {
   }
   }
  1. 打开状态&查看并启动应用程序

更详细:https://developers.facebook.com/docs/android/getting-started/

相关内容

  • 没有找到相关文章