我已经开发了一个带有 TabGroupActivity 的 android 应用程序(例如,参见这个),除了 Facebook 和 Twitter 等社交网络集成之外,一切都运行良好。
此错误在此处和此处和此处之前记录在 Stackoverflow 中
java.lang.RuntimeException: Unable to resume activity {com.xxxx.xxxxx/com.facebook.LoginActivity}: com.facebook.FacebookException: Cannot call LoginActivity with a null calling package. This can occur if the launchMode of the caller is singleInstance.
07-29 18:22:55.757: E/AndroidRuntime(2342): Caused by: com.facebook.FacebookException: Cannot call LoginActivity with a null calling package. This can occur if the launchMode of the caller is singleInstance.
PS:在实施 TabGroupActivity 之前一切正常
更新1:在清单文件中,我将代码更新如下:
<activity
android:name="com.facebook.LoginActivity"
android:label="@string/com_facebook_loginview_log_in_button"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:launchMode="singleTask" />
但异常仍然给出:the launchMode of the caller is singleInstance
为什么这样..??
更新 2:现在我在 Facebook SDK 的 LoginActivity 中保持调试点。对于getCallingPackage(),我得到Null
String callingPackage = getCallingPackage();//Always Null
BackTracing it: On the Calling Activity (FacebookShare.java), I always get data as null instead of some values.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
//Toast.makeText(FacebookShareActivity.this, "onActivityResult", Toast.LENGTH_SHORT).show();
}
谁能解释这种行为..??几天以来,我一直坚持这一点。