Sromku facebook登录问题

时间:2014-09-11 14:12:25

标签: android facebook android-simple-facebook

我尝试使用SimpleFacebook SDK登录并在我的墙上分享内容,但似乎这是不可能的,因为我在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>

有谁知道这里有什么问题?

1 个答案:

答案 0 :(得分:0)

检查清单中的fb app和app id的hashkey

  1. 打开https://developers.facebook.com/
  2. 注册为开发人员
  3. 添加新应用
  4. 打开信息中心,您可在其中找到应用ID
  5. 在AndroidManifest.xml中添加 App ID

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

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

  7. 添加平台 +添加平台,然后选择 Android
  8. 从AndroidManifest.xml
  9. 添加包名称
  10. 对于哈希密钥使用&#39; keytool&#39;:

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

  11. 或以编程方式:

    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. 打开状态&amp;审核并启动应用
    2. 更详细:https://developers.facebook.com/docs/android/getting-started/