我昨天发布了一个 Android 应用程序的更新,今天我在 Crashlytics 中看到了一些崩溃日志:
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapp/com.example.myapp.MyWebViewActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
at com.example.myapp.MyWebViewActivity.onCreate(MyWebViewActivity.java:77)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)
在这份报告的底部提到了 XposedBridge,我觉得这有点奇怪。这是由于有人使用 Xposed 框架试验我的应用程序造成的吗?或者这会发生在“普通用户”身上吗?Crashlytics 表示,到目前为止,该问题已经影响了 3 位用户,但我对此表示怀疑,因为他们都拥有完全相同的手机型号和 Android 版本(摩托罗拉 Nexus 6、Android 7.1.1),并且彼此在 10 分钟内发生。
NPE 是由getIntent().getStringExtra("some_string").equals("another_string")
一种onCreate
方法引起的,即使我在创建此活动的所有地方都设置了“some_string”。
所以我想知道的是,这种崩溃是否可能是除了正在试验 Xposed 的用户之外的任何其他原因造成的?即我应该认真对待还是不认真对待?