You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When getting the location from playServices, the app crashes for some users. Not able to reproduce it.
It has also been reported Here
#Crash Log Fatal Exception: java.lang.NullPointerException: Listener must not be null at com.google.android.gms.common.internal.Preconditions.checkNotNull(SourceFile:2) at com.google.android.gms.common.api.internal.ListenerHolders.createListenerKey(SourceFile:1) at com.google.android.gms.location.FusedLocationProviderClient.removeLocationUpdates(SourceFile:6) at o.computeScrollRange$4.onLocationResult(SourceFile:74) at com.google.android.gms.internal.location.zzaw.notifyListener(SourceFile:2) at com.google.android.gms.common.api.internal.ListenerHolder.zaa(SourceFile:2) at com.google.android.gms.common.api.internal.zacb.run(:4) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:257) at android.app.ActivityThread.main(ActivityThread.java:8183) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:626) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1015)
Test Plan
I'm assuming the fix is straightforward. We deployed a patch of this in our app with success.
I encountered this bug after upgrading from version 3.0.2 to version 3.0.6 of this package. One easy way to reproduce it is to have your app make a second call to getCurrentPosition() before the first call has finished. The mSingleLocationCallback member variable is overwritten when the second call is made (therefore losing track of the first LocationCallback). The mSingleLocationCallback member is set to null when one of the getCurrentPosition() calls finishes finding a location. Then, when the second "get position" call finishes finding a location, null is passed to mFusedLocationClient.removeLocationUpdates() and the Listener must not be null exception occurs.
A little re-architecture might be a good idea, e.g., maintain a list of pending getCurrentPosition() callbacks instead of making a new call to mFusedLocationClient.requestLocationUpdates() for each call an app makes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
When getting the location from playServices, the app crashes for some users. Not able to reproduce it.
It has also been reported Here
#Crash Log
Fatal Exception: java.lang.NullPointerException: Listener must not be null at com.google.android.gms.common.internal.Preconditions.checkNotNull(SourceFile:2) at com.google.android.gms.common.api.internal.ListenerHolders.createListenerKey(SourceFile:1) at com.google.android.gms.location.FusedLocationProviderClient.removeLocationUpdates(SourceFile:6) at o.computeScrollRange$4.onLocationResult(SourceFile:74) at com.google.android.gms.internal.location.zzaw.notifyListener(SourceFile:2) at com.google.android.gms.common.api.internal.ListenerHolder.zaa(SourceFile:2) at com.google.android.gms.common.api.internal.zacb.run(:4) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:257) at android.app.ActivityThread.main(ActivityThread.java:8183) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:626) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1015)Test Plan
I'm assuming the fix is straightforward. We deployed a patch of this in our app with success.