I released an update to an Android app yesterday, and today I am seeing a few crash logs in 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)
At the bottom this report mentions XposedBridge, which I find kind of odd. Is this caused by someone experimenting with my app using the Xposed framework? Or could this happen to a "normal user"? Crashlytics says the issue has affected 3 users so far, but I'm skeptical since they all have the exact same phone model and Android version (Motorola Nexus 6, Android 7.1.1) and happened within 10 minutes of each other.
The NPE is caused by getIntent().getStringExtra("some_string").equals("another_string")
in an onCreate
method, even though I am setting the "some_string" in all places where I'm creating this activity.
So what I'm wondering is if this sort of crash could be the result of anything other than a user who is experimenting with Xposed? I.e. should I take it seriously or not?
Once you have Crashlytics up and running in your app, you can navigate to Crashlytics in your Firebase Console underneath 'Quality' and start reviewing the reports as they come in. If this page still tells you to setup, build or run your app then you have not correctly setup Crashlytics in your app (see Usage).
Non-fatal exceptions captured by your app do not cause crashes but usually indicate certain bugs in code. AppGallery Connect provides a mechanism for recording non-fatal exceptions, helping you monitor these exceptions and improve your code quality.
In general having the XposedBridge
in the stack trace just means that the app runs on an device with XPosed installed. XPosed changes the Dalvik VM system wide, even if your app isn't modified by any XPosed module.
I don't have much experience with Crashlytics, however the "3 users" I would interpret as one user having cleared the app data two times.
Anyway I would always use safe coding, therefore your call
getIntent().getStringExtra("some_string").equals("another_string")
should be reformulated to:
"another_string".equals(getIntent().getStringExtra("some_string"))
This way is may be a bit unfamiliar to read, but it is safe against NullPointerException in case the current Intent does not has the "some_string" value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With