NullPointer on toLowerCase but I don't use that method anywhere
Asked Answered
P

3

63

I'm getting the following crash dump in Firebase Crash Reports:

Exception java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toLowerCase(java.util.Locale)' on a null object reference
bnp.run (bnp.java:56)
java.lang.Thread.run (Thread.java:818)

The problem is that I don't use the String.toLowerCase() method anywhere in the project. In Android Studio, I did Edit->Find In Path for the method and got no results, however, it does appear 100+ times if I search in the libraries. But I cannot find the "bnp.java" anywhere.

Thanks for your help!

Edit: A previous crash report was not proguard-affected and revealed it may be due to google-play-services or Firebase. I only use gms:play-services-places and gms:play-services-auth in my app, along with many Firebase dependencies.

Exception java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toLowerCase(java.util.Locale)' on a null object reference
bnp.run (:com.google.android.gms.DynamiteModulesC:56)
java.lang.Thread.run (Thread.java:818)
Pharyngology answered 24/3, 2017 at 21:51 Comment(19)
@NarendraSorathiya Hi. I don't have a bnp.java file, and cannot even find it in the libraries. I'm not sure what or where it is.Pharyngology
At what point does this NullPointerException get thrown? Right when you start up the app?Memory
@Memory Unfortunately, since it's from a user's crash report, I do not know.Pharyngology
I found a similar crash report from a previous version of the app, when Proguard wasn't enabled. It appears that the error is due to Firebase or Google Messaging: Exception java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toLowerCase(java.util.Locale)' on a null object reference bnp.run (:com.google.android.gms.DynamiteModulesC:56) java.lang.Thread.run (Thread.java:818)Pharyngology
this is a google lib crash code.google.com/p/android/issues/detail?id=233549Irrespirable
@Irrespirable That appears to be the issue. Thanks!Pharyngology
go ahead and post it on the aosp issue tracker. these crashes come in often. small hiccups.Irrespirable
Having the exact same issue here. +1 on the issueWanettawanfried
@TWL, they seem to refer to a different issue. the one stated here is caused by toLowerCase, while the one you linked to is caused by ClassCastException.Wastrel
@PeterKeefe, what is the mobile device that causes this error? I noticed that this error only occurs in Nexus 5X devices for me (according to the crash reporting).Wastrel
@Angel Koh Yeah you might be right, they seem to be unrelated. Mine are also on the 5x so maybe it's a bug with just that phone.Pharyngology
I believe this error only started showing once I enabled proguard so I'm going to ignore gms in proguard rules for the next update and will report back any difference. Unfortunately I don't have a 5x to test with so I cannot reproduce the error, unless maybe the emulator would work.Pharyngology
@Distrustful Keefe I'm seeing the same crash, Nexus 5X only so far. Please confirm if your proguard fix did anything.Distrustful
@Distrustful I just released the update so I hopefully soon I will be able to confirm if the Proguard fix worked.Pharyngology
@Distrustful My proguard changes did not fix the issue. Will keep looking for a fixPharyngology
I have the same issue too with the same LG Nexus 5x. +1 for you.Chazan
any fix? :\ same issue...Waxwing
any fixes on this i am also getting this crash report but not able to get the issue.Suspense
@Irrespirable does this seem like the same thing? Can't for the life of me find a way to debug this issue or figure out where it is coming from!Reheat
W
53

I can't comment yet, so I will post this as a possible solution, but this seems like an error on Google's side. Multiple people are reporting this crash on the exact same device with the exact same region. So it seems Google runs your app on a virtual or automated device and then that device crashes. This device seems to be a Nexus 5x with local us-US and API level 23.

Source: https://code.google.com/p/android/issues/detail?id=233549

Whitleather answered 7/4, 2017 at 10:7 Comment(16)
How do you know it's a virtual device? I agree though that it appears to be either an automated device or virtual device, since this only appears on Nexus 5x running Android 6.0.1, in portrait mode, while charging, on GSM ATT or T-Mobile networks.Pharyngology
You are making a valid point, I'm actually not sure if it is a virtual device, this was an assumption I'm making based on the fact that the device is exactly the same (including charging) every time. I will update my answer to reflect this.Whitleather
@TeunVos, That is very likely. My app is only deployed in my country, but I see that the crash originates from US on the Nexus 5x.Wastrel
Same problem here, also Nexus 5 API 23, but the battery changes a lot, and I receive from ATT and T-Mobile networks..Sabrina
Yep, same here - Nexus 5x API 23, ATT or T-mobile, ~30 instances already. Man, why not update to Nougat at least?Haste
I got this error today, Nexus 5X API 23, Any news or solutions?Phenix
I got this error a few times also just on the Nexus 5X API 23.Laurenlaurena
Country Code: 310, Carrier Code: 270, Carrier: T-Mobile, Locale: en-US, trending_up, Performance, VM free: 1.61MB, VM total: 8.23MB, VM max: 192MB, Battery level: 75%, Charging state: Charging AC, Connection State: Wwan, stay_primary_portraits, Device, Manufacturer: LGE, Model: Nexus 5X, Board: Bullhead, Android API: 23, Android OS: 6.0.1, Brand: Google, RAM: 3.96GB, Orientation: Landscape, Proximity to user: —, bug_report, Error, Date: Oct 2, 2017, 9:14:56 PM,Journalism
The reports for this crash seem to be from a few months ago and I remember getting them then, but now I've started getting them again, 5x again. Anyone else getting them?Kelsiekelso
@Kelsiekelso I am getting this crash for the first time now from a 5x as well.(same specs)Hapsburg
I'm pretty sure it is just the Google automated test as I did a staged release and I haven't seen any new crash reports except for those few.Kelsiekelso
In our case 100% of the devices with this exception are rooted which also adds validity to the hypothesis that its a automated test device. Some of their test devices also start the app on future dates, once for each day for around the next 20-30 daysPeal
Anything new on this topic? 1 year later it's still occurring. Maybe updating google play services?Impropriety
Don't panic guys this is an issue from google. and has been reported only when you upload a new build after that it disappears.Vassili
Well after some time, I can say it's not only when I upload a new build, it repeats from time to time without any reason. Always the same device, rooted Nexus 5X, Android 6.0.1. I wonder why they don't fix so dumb bug.Plaint
@SandeepSinghRana does this seem like the same thing? Can't debug this issue or figure out where it is coming from!Reheat
D
0

I got this error when my code was trying to create a connection to certain amqp service using an invalid URL. Once I modified it to the proper value, the exception is gone. So check your code.

Dodi answered 27/4, 2019 at 16:39 Comment(0)
I
-1

My app ran into a similar issue.

When launched in Stock android devices(Mi A1), the App crashed with " keeps stopping popup". The Crashlytics in Fabric reported it as the

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toLowerCase(java.util.Locale)' on a null object reference
   at bfx.run(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (040708-202483333):80)
   at java.lang.Thread.run(Thread.java:818)

But when I checked the Pre-launch report of the Release management in Google Play Console, it showed that the app was crashing for Pixel & Pixel 2 for an entirely different reason. The issue shown was

FATAL EXCEPTION: main Process: in.quickall.quickall, PID: 8345
java.lang.RuntimeException: Unable to start activity ComponentInfo{in.quickall.quickall/in.quickall.quickall.Main.MainActivity}: android.content.res.Resources$NotFoundException: Drawable in.quickall.quickall:drawable/splash_screen with resource ID #0x7f0700c0
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6541)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

And the issue started from the APK version were I implemented the code (given below) to remove the white screen on launch.

<style name="SplashTheme" parent="AppTheme">
    <item name="android:windowBackground">@drawable/splash_screen</item>
</style>

I removed this piece of code and now the Pre-launch report shows it as working fine in the Pixel devices.

Now the app launches correctly, but has to have the white screen at launch.

Iodous answered 28/7, 2018 at 9:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.