java.lang.NullPointerException 在 Android 上使用 Facebook 模块时

java.lang.NullPointerException when using Facebook Module on Android

将最新的 Facebook (v2.12) 模块与 Trigger.io(平台 v2.2.14)一起使用,尝试 "Login with Facebook" 会导致应用程序崩溃并在日志中显示以下内容:

07-20 12:10:46.834: E/AndroidRuntime(7013): FATAL EXCEPTION: main
07-20 12:10:46.834: E/AndroidRuntime(7013): Process: com.myapp, PID: 7013
07-20 12:10:46.834: E/AndroidRuntime(7013): java.lang.RuntimeException: Unable to resume activity {com.myapp/com.facebook.LoginActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setVisibility(int)' on a null object reference
07-20 12:10:46.834: E/AndroidRuntime(7013):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2986)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3017)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at android.app.ActivityThread.access0(ActivityThread.java:151)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at android.os.Handler.dispatchMessage(Handler.java:102)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at android.os.Looper.loop(Looper.java:135)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at android.app.ActivityThread.main(ActivityThread.java:5254)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at java.lang.reflect.Method.invoke(Native Method)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at java.lang.reflect.Method.invoke(Method.java:372)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
07-20 12:10:46.834: E/AndroidRuntime(7013): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setVisibility(int)' on a null object reference
07-20 12:10:46.834: E/AndroidRuntime(7013):     at com.facebook.LoginActivity.onBackgroundProcessingStarted(Unknown Source)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at com.facebook.AuthorizationClient.notifyBackgroundProcessingStart(Unknown Source)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at com.facebook.AuthorizationClient.access(Unknown Source)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at com.facebook.AuthorizationClient$GetTokenAuthHandler.tryAuthorize(Unknown Source)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at com.facebook.AuthorizationClient.tryCurrentHandler(Unknown Source)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at com.facebook.AuthorizationClient.tryNextHandler(Unknown Source)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at com.facebook.AuthorizationClient.authorize(Unknown Source)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at com.facebook.AuthorizationClient.startOrContinueAuth(Unknown Source)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at com.facebook.LoginActivity.onResume(Unknown Source)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1257)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at android.app.Activity.performResume(Activity.java:6076)
07-20 12:10:46.834: E/AndroidRuntime(7013):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2975)

我已经仔细检查了Facebook上的App ID、Key Hash和相关设置,但一直报错。有没有人遇到同样的问题,你是如何解决的?

Trigger.io Facebook Module v2.13 修复了 Android 上的登录问题。