Facebook 登录我的应用程序后,在 onActivityResult 获得 NPE。似乎大多数用户都可以正常工作,但有些用户报告了这个问题。我正在使用 SDK 3.5.2。
java.lang.RuntimeException: Unable to resume activity {------------}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=64206, result=0, data=Intent { (has extras) }} to activity {----------------------------------}: java.lang.NullPointerException at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3170) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3185) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) at android.app.ActivityThread.access$2300(ActivityThread.java:132) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4669) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=64206, result=0, data=Intent { (has extras) }} to activity {-----------------------}: java.lang.NullPointerException at android.app.ActivityThread.deliverResults(ActivityThread.java:3557) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3157) ... 12 more Caused by: java.lang.NullPointerException at -----------------------------(LogIn.java:720) at android.app.Activity.dispatchActivityResult(Activity.java:3905) at android.app.ActivityThread.deliverResults(ActivityThread.java:3553) ... 13 more java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=64206, result=0, data=Intent { (has extras) }} to activity {----------------------------------}: java.lang.NullPointerException at android.app.ActivityThread.deliverResults(ActivityThread.java:3557) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3157) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3185) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) at android.app.ActivityThread.access$2300(ActivityThread.java:132) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4669) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at ------------------------------------(LogIn.java:720) at android.app.Activity.dispatchActivityResult(Activity.java:3905) at android.app.ActivityThread.deliverResults(ActivityThread.java:3553) ... 13 more java.lang.NullPointerException at ------------------------------------(LogIn.java:720) at android.app.Activity.dispatchActivityResult(Activity.java:3905) at android.app.ActivityThread.deliverResults(ActivityThread.java:3553) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3157) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3185) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) at android.app.ActivityThread.access$2300(ActivityThread.java:132) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4669) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634) at dalvik.system.NativeStart.main(Native Method)
这是我在这一行的代码。
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data){
super.onActivityResult(requestCode, resultCode, data);
Session.getActiveSession().onActivityResult(this, requestCode, resultCode , data);
onActivityResult = true;
}