Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting 'java.lang.String.toLowerCase()' on a null object reference' in crashlytics report in 'com.google.android.gms.internal.zzbsp.zzabx' class

I have an app and I have integrated Crashlystics library in it which catches fatal issues in app and report back to the developer.

Here's how:

public class MyApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        Fabric.with(this, new Crashlytics());
    }
}

Here are dependencies:

apply plugin: 'io.fabric'
compile('com.crashlytics.sdk.android:crashlytics:2.6.6@aar') {
        transitive = true;
}
compile 'com.google.android.gms:play-services:10.2.0'

Today, I got a report showing me this error: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 in com.google.android.gms.internal.zzbsp.zzabx (Unknown Source) class. This error happened on a LGE device running android marshmallow.

Full stacktrace from Fabric.io's crashlytics:

#0. Crashed: TubeSockReader-1: 0 0 0x0000000000000000
       at com.google.android.gms.internal.zzbsp.zzabx(Unknown Source)
       at com.google.android.gms.internal.zzbsm.zzabv(Unknown Source)
       at com.google.android.gms.internal.zzbsm.getThreadFactory(Unknown Source)
       at com.google.android.gms.internal.zzbsm$2.run(Unknown Source)
       at java.lang.Thread.run(Thread.java:818)

--

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 com.google.android.gms.internal.zzbsp.zzabx(Unknown Source)
       at com.google.android.gms.internal.zzbsm.zzabv(Unknown Source)
       at com.google.android.gms.internal.zzbsm.getThreadFactory(Unknown Source)
       at com.google.android.gms.internal.zzbsm$2.run(Unknown Source)
       at java.lang.Thread.run(Thread.java:818)

#0. Crashed: TubeSockReader-1: 0 0 0x0000000000000000
       at com.google.android.gms.internal.zzbsp.zzabx(Unknown Source)
       at com.google.android.gms.internal.zzbsm.zzabv(Unknown Source)
       at com.google.android.gms.internal.zzbsm.getThreadFactory(Unknown Source)
       at com.google.android.gms.internal.zzbsm$2.run(Unknown Source)
       at java.lang.Thread.run(Thread.java:818)

#1. HeapTaskDaemon
       at dalvik.system.VMRuntime.runHeapTasks(VMRuntime.java)
       at java.lang.Daemons$HeapTaskDaemon.run(Daemons.java:355)
       at java.lang.Thread.run(Thread.java:818)

#2. pool-6-thread-1
       at java.lang.Object.wait(Object.java)
       at java.lang.Thread.parkFor$(Thread.java:1220)
       at sun.misc.Unsafe.park(Unsafe.java:299)
       at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:198)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2053)
       at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1090)
       at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1071)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1038)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at java.lang.Thread.run(Thread.java:818)

#3. OkHttp ConnectionPool
       at java.lang.Object.wait(Object.java)
       at com.android.okhttp.ConnectionPool.performCleanup(ConnectionPool.java:305)
       at com.android.okhttp.ConnectionPool.runCleanupUntilPoolIsEmpty(ConnectionPool.java:242)
       at com.android.okhttp.ConnectionPool.-wrap0(ConnectionPool.java)
       at com.android.okhttp.ConnectionPool$1.run(ConnectionPool.java:97)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at java.lang.Thread.run(Thread.java:818)

#4. TubeSockReader-1
       at java.lang.Object.wait(Object.java)
       at java.lang.Thread.parkFor$(Thread.java:1220)
       at sun.misc.Unsafe.park(Unsafe.java:299)
       at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
       at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:421)
       at java.util.concurrent.FutureTask.get(FutureTask.java:163)
       at com.crashlytics.android.core.CrashlyticsBackgroundWorker.submitAndWait(SourceFile:43)
       at com.crashlytics.android.core.CrashlyticsController.handleUncaughtException(SourceFile:278)
       at com.crashlytics.android.core.CrashlyticsController$5.onUncaughtException(SourceFile:262)
       at com.crashlytics.android.core.CrashlyticsUncaughtExceptionHandler.uncaughtException(SourceFile:30)
       at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
       at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)

#5. GAC_Executor[1]
       at java.lang.Object.wait(Object.java)
       at java.lang.Thread.parkFor$(Thread.java:1220)
       at sun.misc.Unsafe.park(Unsafe.java:299)
       at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
       at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1038)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at com.google.android.gms.internal.zzadd.run(Unknown Source)
       at java.lang.Thread.run(Thread.java:818)

#6. Queue
       at java.lang.Object.wait(Object.java)
       at java.lang.Thread.parkFor$(Thread.java:1220)
       at sun.misc.Unsafe.park(Unsafe.java:299)
       at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
       at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:510)
       at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation(SourceFile:197)
       at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get(SourceFile:236)
       at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(SourceFile:65)
       at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(SourceFile:46)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1038)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at java.lang.Thread.run(Thread.java:818)

#7. Answers Events Handler1
       at java.lang.Object.wait(Object.java)
       at java.lang.Thread.parkFor$(Thread.java:1220)
       at sun.misc.Unsafe.park(Unsafe.java:299)
       at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:198)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2053)
       at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1090)
       at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1071)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1038)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at io.fabric.sdk.android.services.common.ExecutorUtils$1$1.onRun(SourceFile:75)
       at io.fabric.sdk.android.services.common.BackgroundPriorityRunnable.run(SourceFile:30)
       at java.lang.Thread.run(Thread.java:818)

#8. GoogleApiHandler
       at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
       at android.os.MessageQueue.next(MessageQueue.java:323)
       at android.os.Looper.loop(Looper.java:135)
       at android.os.HandlerThread.run(HandlerThread.java:61)

#9. main
       at java.lang.Character.isDigit(Character.java:2672)
       at java.lang.Character.isDigit(Character.java:2658)
       at java.util.Formatter$FormatSpecifierParser.nextInt(Formatter.java:2406)
       at java.util.Formatter$FormatSpecifierParser.parseArgumentIndexAndFlags(Formatter.java:2329)
       at java.util.Formatter$FormatSpecifierParser.parseFormatToken(Formatter.java:2298)
       at java.util.Formatter.doFormat(Formatter.java:1071)
       at java.util.Formatter.format(Formatter.java:1042)
       at java.util.Formatter.format(Formatter.java:1011)
       at java.lang.String.format(String.java:1554)
       at java.lang.String.format(String.java:1528)
       at com.getsportalapp.sportal.SignUpActivity$7.run(SourceFile:599)
       at android.os.Handler.handleCallback(Handler.java:739)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:5421)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

#10. AsyncTask #2
       at java.lang.Object.wait(Object.java)
       at java.lang.Thread.parkFor$(Thread.java:1220)
       at sun.misc.Unsafe.park(Unsafe.java:299)
       at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
       at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1038)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at java.lang.Thread.run(Thread.java:818)

#11. FinalizerWatchdogDaemon
       at java.lang.Thread.sleep(Thread.java)
       at java.lang.Thread.sleep(Thread.java:1031)
       at java.lang.Thread.sleep(Thread.java:985)
       at java.lang.Daemons$FinalizerWatchdogDaemon.sleepFor(Daemons.java:273)
       at java.lang.Daemons$FinalizerWatchdogDaemon.waitForFinalization(Daemons.java:284)
       at java.lang.Daemons$FinalizerWatchdogDaemon.run(Daemons.java:232)
       at java.lang.Thread.run(Thread.java:818)

#12. GAC_Executor[0]
       at java.lang.Object.wait(Object.java)
       at java.lang.Thread.parkFor$(Thread.java:1220)
       at sun.misc.Unsafe.park(Unsafe.java:299)
       at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
       at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1038)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at com.google.android.gms.internal.zzadd.run(Unknown Source)
       at java.lang.Thread.run(Thread.java:818)

#13. AsyncTask #1
       at java.lang.Object.wait(Object.java)
       at java.lang.Thread.parkFor$(Thread.java:1220)
       at sun.misc.Unsafe.park(Unsafe.java:299)
       at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
       at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1038)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at java.lang.Thread.run(Thread.java:818)

#14. pool-1-thread-1
       at java.lang.Object.wait(Object.java)
       at java.lang.Thread.parkFor$(Thread.java:1220)
       at sun.misc.Unsafe.park(Unsafe.java:299)
       at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
       at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1038)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at java.lang.Thread.run(Thread.java:818)

#15. pool-2-thread-1
       at java.lang.Object.wait(Object.java)
       at java.lang.Thread.parkFor$(Thread.java:1220)
       at sun.misc.Unsafe.park(Unsafe.java:299)
       at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:198)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2053)
       at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1090)
       at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1071)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1038)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at java.lang.Thread.run(Thread.java:818)

#16. FirebaseDatabaseWorker
       at java.lang.Object.wait(Object.java)
       at java.lang.Thread.parkFor$(Thread.java:1220)
       at sun.misc.Unsafe.park(Unsafe.java:299)
       at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:198)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2053)
       at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1090)
       at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1071)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1038)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at java.lang.Thread.run(Thread.java:818)

#17. pool-3-thread-1
       at java.lang.Object.wait(Object.java)
       at java.lang.Thread.parkFor$(Thread.java:1220)
       at sun.misc.Unsafe.park(Unsafe.java:299)
       at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:198)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2053)
       at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1090)
       at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1071)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1038)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at java.lang.Thread.run(Thread.java:818)

#18. Measurement Worker
       at java.lang.Object.wait(Object.java)
       at java.lang.Object.wait(Object.java:423)
       at com.google.android.gms.internal.zzaud$zzd.run(Unknown Source)

#19. Queue
       at java.lang.Object.wait(Object.java)
       at java.lang.Thread.parkFor$(Thread.java:1220)
       at sun.misc.Unsafe.park(Unsafe.java:299)
       at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
       at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:510)
       at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation(SourceFile:197)
       at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get(SourceFile:236)
       at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(SourceFile:65)
       at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(SourceFile:46)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1038)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at java.lang.Thread.run(Thread.java:818)

#20. FinalizerDaemon
       at java.lang.Object.wait(Object.java)
       at java.lang.Object.wait(Object.java:423)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:101)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:72)
       at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:185)
       at java.lang.Thread.run(Thread.java:818)

#21. ReferenceQueueDaemon
       at java.lang.Object.wait(Object.java)
       at java.lang.Daemons$ReferenceQueueDaemon.run(Daemons.java:147)
       at java.lang.Thread.run(Thread.java:818)

#22. Crashlytics Exception Handler1
       at dalvik.system.VMStack.getThreadStackTrace(VMStack.java)
       at java.lang.Thread.getStackTrace(Thread.java:580)
       at java.lang.Thread.getAllStackTraces(Thread.java:522)
       at com.crashlytics.android.core.CrashlyticsController.writeSessionEvent(SourceFile:1092)
       at com.crashlytics.android.core.CrashlyticsController.writeFatal(SourceFile:831)
       at com.crashlytics.android.core.CrashlyticsController.access$100(SourceFile:59)
       at com.crashlytics.android.core.CrashlyticsController$6.call(SourceFile:285)
       at com.crashlytics.android.core.CrashlyticsController$6.call(SourceFile:278)
       at java.util.concurrent.FutureTask.run(FutureTask.java:237)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at io.fabric.sdk.android.services.common.ExecutorUtils$1$1.onRun(SourceFile:75)
       at io.fabric.sdk.android.services.common.BackgroundPriorityRunnable.run(SourceFile:30)
       at java.lang.Thread.run(Thread.java:818)

What is this error and why am I getting it?

like image 395
Hammad Nasir Avatar asked Mar 05 '17 13:03

Hammad Nasir


2 Answers

This is a bug in the GMS library. Tis error occurs on some virtual testing devices from Google (always Nexus 5x API 23 en-US ...)

See this question for further information: NullPointer on toLowerCase but I don't use that method anywhere

This is the issue: https://issuetracker.google.com/issues/37135148

like image 83
Alexander Schaefer Avatar answered Sep 21 '22 13:09

Alexander Schaefer


Firstly, you posted a thread dump, which is only slightly helpful, when what is really needed to diagnose the issue is the full stack trace from the exception.

That said, the only Activity that shows up in the thread dump is SignUpActivity, so I'd suggest looking there.

The error is literally from an attempt to call toLowerCase on a null String reference. This can happen, for instance, if you use an AsyncTask, and access a Text field from the background thread, but the Activity has been destroyed (e.g. device rotation).

The bit about 'com.google.android.gms.internal.zzbsp.zzabx' is most likely a red-herring, a side-effect of the crash reporting library. Look to your own code first.

Also, as previously mentioned, the actual stack trace, if available, would probably be really helpful.

like image 44
GreyBeardedGeek Avatar answered Sep 21 '22 13:09

GreyBeardedGeek