Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when accessing location twice #131

Closed
1 task
kunit1 opened this issue Oct 19, 2018 · 9 comments
Closed
1 task

Crash when accessing location twice #131

kunit1 opened this issue Oct 19, 2018 · 9 comments

Comments

@kunit1
Copy link

kunit1 commented Oct 19, 2018

馃悰 Bug Report

I have a screen that calls getCurrentPosition(desiredAccuracy: LocationAccuracy.high)

Upon navigating to the screen for the first time the location is returned correctly. However, when I navigate out of the screen and then go back to the screen the app crashes and the following stack trace is thrown

E/AndroidRuntime(22272): java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime(22272): 	at io.flutter.view.FlutterNativeView$1.reply(FlutterNativeView.java:174)
E/AndroidRuntime(22272): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:203)
E/AndroidRuntime(22272): 	at com.baseflow.flutter.plugin.geolocator.data.Result.success(Result.java:22)
E/AndroidRuntime(22272): 	at com.baseflow.flutter.plugin.geolocator.tasks.LocationUpdatesUsingLocationServicesTask.reportLocationUpdate(LocationUpdatesUsingLocationServicesTask.java:108)
E/AndroidRuntime(22272): 	at com.baseflow.flutter.plugin.geolocator.tasks.LocationUpdatesUsingLocationServicesTask.access$000(LocationUpdatesUsingLocationServicesTask.java:19)
E/AndroidRuntime(22272): 	at com.baseflow.flutter.plugin.geolocator.tasks.LocationUpdatesUsingLocationServicesTask$1.onLocationResult(LocationUpdatesUsingLocationServicesTask.java:40)
E/AndroidRuntime(22272): 	at com.google.android.gms.internal.location.zzau.notifyListener(Unknown Source)
E/AndroidRuntime(22272): 	at com.google.android.gms.common.api.internal.ListenerHolder.notifyListenerInternal(Unknown Source)
E/AndroidRuntime(22272): 	at com.google.android.gms.common.api.internal.ListenerHolder$zaa.handleMessage(Unknown Source)
E/AndroidRuntime(22272): 	at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(22272): 	at android.os.Looper.loop(Looper.java:158)
E/AndroidRuntime(22272): 	at android.app.ActivityThread.main(ActivityThread.java:7237)
E/AndroidRuntime(22272): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(22272): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
E/AndroidRuntime(22272): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Expected behavior

App shouldn't crash and location is returned correctly

Reproduction steps

  1. Access location on screen 1
  2. Go to screen 2
  3. Go back to screen 1 Quickly

Configuration

Version: 2.1.0

Platform:

  • 馃摫 iOS
  • [ x] 馃 Android
@hafizidev
Copy link

hafizidev commented Oct 23, 2018

Happens to me as well. For me the application was in the background while I was turning on the location service. When came back to the application, it crash. Throwing the exact same error.

@supardyke
Copy link

same here, how soon can this be fixed

@ibrierley
Copy link

Just as a workaround in the meantime, does it stop your app crashing if you put it in a try/catch clause ?

@kunit1
Copy link
Author

kunit1 commented Nov 28, 2018

@ibrierley Do you mean add a try/catch clause in the Java code or the Dart code? The crash is coming from the Java code which is part of the plugin

@ibrierley
Copy link

I meant putting it in a on PlatformException catch...eg I have something like this in my code...

try {
      position = await Geolocator().getCurrentPosition(
          desiredAccuracy: LocationAccuracy.high);

    } on PlatformException catch (e) {
      print("!!!!" + e.toString());

    } catch (e) {
      p("!!GEOLOC ERROR " + e.toString());
    }

However, I'm not sure if that would catch that specific error at that level or not, as that looks like a low level. It's just odd, as I have seen that error in my code, but I don't think it's crashed it (but I may be wrong and not been completely aware of what happened).

@ibrierley
Copy link

Actually I think the above doesn't handle it still digging further, so can probably ignore that.

@mulderpf
Copy link

Just to add to this - I have noticed the same crash in a production version of the app. To give some context in terms of rarity - it happened to 5 users out of over 5000. Not sure if this is maybe a Flutter issue, rather than specific to this plugin?

@mulderpf
Copy link

mulderpf commented Jan 29, 2019

Looking through my Android crashes, this one is affecting me the most, although still with low rarity as mentioned before. I have all of the necessary try catches in my Dart code, but this crashes on the Java side I suspect. I don't know much about plugins, but it would be nice if this either didn't happen or was handled.

Here is a crash trace (it's from production):
java.lang.IllegalStateException: java.lang.IllegalStateException:
at io.flutter.view.FlutterNativeView$PlatformMessageHandlerImpl$1.reply (Unknown Source:82)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success (Unknown Source:14)
at com.baseflow.flutter.plugin.geolocator.data.Result.success (Unknown Source:6)
at com.baseflow.flutter.plugin.geolocator.tasks.LocationUpdatesUsingLocationServicesTask.reportLocationUpdate (Unknown Source:12)
at com.baseflow.flutter.plugin.geolocator.tasks.LocationUpdatesUsingLocationServicesTask.access$000 (Unknown Source)
at com.baseflow.flutter.plugin.geolocator.tasks.LocationUpdatesUsingLocationServicesTask$1.onLocationResult (Unknown Source:27)
at com.google.android.gms.internal.c.l.notifyListener (Unknown Source:4)
at com.google.android.gms.common.api.internal.ListenerHolder.notifyListenerInternal (Unknown Source:8)
at com.google.android.gms.common.api.internal.ListenerHolder$zaa.handleMessage (Unknown Source:16)
at android.os.Handler.dispatchMessage (Handler.java:105)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:6938)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
at io.flutter.view.FlutterNativeView$PlatformMessageHandlerImpl$1.reply (Unknown Source:82)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success (Unknown Source:14)
at com.baseflow.flutter.plugin.geolocator.data.Result.success (Unknown Source:6)
at com.baseflow.flutter.plugin.geolocator.tasks.LocationUpdatesUsingLocationServicesTask.reportLocationUpdate (Unknown Source:12)
at com.baseflow.flutter.plugin.geolocator.tasks.LocationUpdatesUsingLocationServicesTask.access$000 (Unknown Source)
at com.baseflow.flutter.plugin.geolocator.tasks.LocationUpdatesUsingLocationServicesTask$1.onLocationResult (Unknown Source:27)
at com.google.android.gms.internal.c.l.notifyListener (Unknown Source:4)
at com.google.android.gms.common.api.internal.ListenerHolder.notifyListenerInternal (Unknown Source:8)
at com.google.android.gms.common.api.internal.ListenerHolder$zaa.handleMessage (Unknown Source:16)
at android.os.Handler.dispatchMessage (Handler.java:105)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:6938)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)

Pretty much seen on most Android versions I am targeting: 4.4, 5.0, 5.1, 6.0, 7.0, 7.1, 8.0, 8.1, 9. Seen on a large variety of devices. Seen 56 times and affected 43 users, in most cases, it doesn't affect the same user.

@mulderpf
Copy link

Is there anything that can be done to resolve this crash - it is negatively impacting my Play Store ranking due to the crash rate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants