我尝试使用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>
有谁知道这里有什么问题?
答案 0 :(得分:0)
检查清单中的fb app和app id的hashkey
在AndroidManifest.xml中添加 App ID
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="**App ID**"
/>
打开设置并添加电子邮件
对于哈希密钥使用&#39; keytool&#39;:
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) {
}
}
更详细:https://developers.facebook.com/docs/android/getting-started/