ExperimentationConfigurator Fatal Exception: java.lang.NullPointerException
2018-02-07 11:00
399 查看
一.问题
之前因为facebook的SDK许久未更新我们把Facebook SDK从4.11.0更新到4.30.0
compile 'com.facebook.android:facebook-login:4.30.0' compile 'com.facebook.android:account-kit-sdk:4.30.0'
遇到了很多下面的这个问题
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'org.json.JSONArray org.json.JSONObject.getJSONArray(java.lang.String)' on a null object reference at com.facebook.accountkit.internal.ExperimentationConfigurator$2$1.onCompleted(SourceFile:93) at com.facebook.accountkit.internal.AccountKitGraphRequestAsyncTask.onPostExecute(SourceFile:188) at com.facebook.accountkit.internal.AccountKitGraphRequestAsyncTask.onPostExecute(SourceFile:42) at android.os.AsyncTask.finish(AsyncTask.java:651) at android.os.AsyncTask.access$500(AsyncTask.java:180) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7325) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
二.解决方案
1.是追溯调用栈的信息。
发现即使看不到调用栈,也追溯到了AccountKit.initialize()方法会间接的调用到了Crash的代码位置。
2.查看自己代码
果然有AccountKit.initialize()的相关调用。可是已经
@Deprecated。
然后去官网查了一下Changelog:
Facebook SDK for Android Changelog 4.x
调查发现在4.11.0-4.30.0之间的Changelog中有这样一段
4.19.0 - January 25, 2017 Facebook SDK Modified Facebook SDK is now auto initialized when the application starts. In most cases a manual call to FacebookSDK.sdkInitialize() is no longer needed. See upgrade guide for more details. Activate App is now called during SDK initialization. To disable this feature please follow the directions in the upgrade guide. Update the look and feel of LoginButton. See upgrade guide for more details. Fixed Possible memory leak in ActivityLifecycleTracker Audience Network SDK Added Foregrounding/backgrounding listeners added to MediaView. Fixed Crash in NativeAdsManager fixed for Android API < 18. onComplete method in MediaViewListener is now properly called when video playback finishes. Crash when launching In-App Browser due to unsupported protocols. Account Kit SDK Modified Account Kit SDK is now auto initialized when the application starts. In most cases a manual call to AccountKit.initialize() is no longer needed. See upgrade guide for more details. Default Account Kit Instant Verification button as "Continue" Fixed Fixes crash bug where Android 7+ will throw exception if a file is marked WORLD_ Back arrow theming in entry screen Setting focus on first entry field in confirmation code entry screen VI translations Checking permissions behavior on certain devices Added Logging for country codes
其中呢,注意到2条。4.19.0这个版本之后。
AccountKit.initialize(),
FacebookSdk.sdkInitialize(ctx);都已经
@Deprecated掉了。查看sdk源码获知,SDK已经通过
AccountKitInitProvider,
FacebookInitProvider两个ContentProvider的方式,在更早的时间节点完成了初始化。所以就不用我们手动初始化了。抱着试试看的想法,去掉了。无用的初始化调用。结果BUG量直线下降。虽然fabric上还有个别情况发生。但是已经不再是Rank榜第一了。
虽然还是想不通。多调用一次init为什么会导致这样的问题。但还是算先改掉了这个BUG吧。
3.统计自动调用。
当然这个也不需要手动调用了。AppEventsLogger.activateApp(this);
相关文章推荐
- Stacktrace:] with root cause java.lang.NullPointerException 【jsp】
- spring/struts异常exception starting filter struts2 java.lang.NullPointerException ..SpringObjectFacory
- 测试类提示错误:java.lang.NullPointerException
- 菜鸟学习笔记:java中使用Integer.getInteger(String)有java.lang.NullPointerException
- SSH使用modelDriven传值出现空指针异常 java.lang.NullPointerException
- 空指针错误 java.lang.NullPointerException 浅谈
- mybatis java.lang.NullPointerException
- 异常:failed for object com.sdu.crm.pojo.Customer@136a986 [java.lang.NullPointerException]
- java.lang.NullPointerException: println needs a me
- 在Servlet使用getServletContext()获取ServletContext对象出现java.lang.NullPointerException(空指针)异常的解决办法
- ssm java.lang.NullPointerException
- 【JFinal】WARN:oejuc.AbstractLifeCycle:FAILED jfinal: java.lang.NullPointerException
- Stacktraces 报 java.lang.NullPointerException
- 严重: Servlet.service() for servlet jsp threw exception java.lang.NullPointerException
- Java.lang.NullPointerException
- 利用Struts标签开发jsp页面表单提示java.lang.NullPointerException: Module 'null' not found.
- JAVA中的空指针异常(java.lang.NullPointerException)
- EClipse + NDK java.lang.NullPointerException 的解决方法
- java.lang.NullPointerException问题
- 避免java.lang.NullPointerException错误(jsp调试过程中烦人而无奈的java异常)