Turn off wifi and mobile network and call:
await Geolocator().getCurrentPosition(
desiredAccuracy: LocationAccuracy.high,
locationPermissionLevel: GeolocationPermission.locationAlways);
flutter doctor -v
[✓] Flutter (Channel stable, v1.9.1+hotfix.4, on Linux, locale pt_BR.UTF-8)
• Flutter version 1.9.1+hotfix.4 at /home/vertech/Documentos/Renan/flutter
• Framework revision cc949a8e8b (13 dias atrás), 2019-09-27 15:04:59 -0700
• Engine revision b863200c37
• Dart version 2.5.0[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0-rc3)
• Android SDK at /home/vertech/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.0-rc3
• ANDROID_HOME = /home/vertech/Android/Sdk
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.[✓] Android Studio (version 3.5)
• Android Studio at /opt/android-studio
• Flutter plugin version 38.2.3
• Dart plugin version 191.8423
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)[✓] VS Code (version 1.39.0)
• VS Code at /usr/share/code
• Flutter extension version 3.5.1[✓] Connected device (1 available)
• SM G930F • ce061606d029790701 • android-arm64 • Android 8.0.0 (API 26)• No issues found!
Version: ^5.1.4+1
Platform:
I have tried searching about this issue extensively but I could not find an answer.
My Clima App refuses to give me the geolocation. The geolocator package does not seem to work. I am really confused about this.
The error I get is :
I/art ( 6109): at void android.os.MessageQueue.nativePollOnce(long, int) (MessageQueue.java:-2)
I/art ( 6109): at android.os.Message android.os.MessageQueue.next() (MessageQueue.java:328)
I/art ( 6109): at void android.os.Looper.loop() (Looper.java:148)
I/art ( 6109): at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6251)
I/art ( 6109): at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
I/art ( 6109): at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1075)
I/art ( 6109): at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:936)
I/art ( 6109):
E/flutter ( 6109): [ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(39)] java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArraySet;
E/flutter ( 6109): at com.google.android.gms.common.api.internal.GoogleApiManager.(Unknown Source)
E/flutter ( 6109): at com.google.android.gms.common.api.internal.GoogleApiManager.zab(Unknown Source)
E/flutter ( 6109): at com.google.android.gms.common.api.GoogleApi.(Unknown Source)
E/flutter ( 6109): at com.google.android.gms.common.api.GoogleApi.(Unknown Source)
E/flutter ( 6109): at com.google.android.gms.location.FusedLocationProviderClient.(Unknown Source)
E/flutter ( 6109): at com.google.android.gms.location.LocationServices.getFusedLocationProviderClient(Unknown Source)
E/flutter ( 6109): at com.baseflow.geolocator.tasks.LocationUpdatesUsingLocationServicesTask.(LocationUpdatesUsingLocationServicesTask.java:29)
E/flutter ( 6109): at com.baseflow.geolocator.tasks.TaskFactory.createCurrentLocationTask(TaskFactory.java:44)
E/flutter ( 6109): at com.baseflow.geolocator.GeolocatorPlugin.onMethodCall(GeolocatorPlugin.java:66)
E/flutter ( 6109): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222)
E/flutter ( 6109): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
E/flutter ( 6109): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:656)
E/flutter ( 6109): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter ( 6109): at android.os.MessageQueue.next(MessageQueue.java:328)
E/flutter ( 6109): at android.os.Looper.loop(Looper.java:148)
E/flutter ( 6109): at android.app.ActivityThread.main(ActivityThread.java:6251)
E/flutter ( 6109): at java.lang.reflect.Method.invoke(Native Method)
E/flutter ( 6109): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1075)
E/flutter ( 6109): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
E/flutter ( 6109): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.util.ArraySet" on path: DexPathList[[zip file "/data/app/com.example.geol-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.geol-1/lib/arm, /data/app/com.example.geol-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib, /system/vendor/lib]]
E/flutter ( 6109): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
E/flutter ( 6109): at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
E/flutter ( 6109): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/flutter ( 6109): ... 19 more
E/flutter ( 6109):
F/flutter ( 6109): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(76)] Check failed: CheckException(env).
F/libc ( 6109): Fatal signal 6 (SIGABRT), code -6 in tid 6109 (om.example.geol)
Lost connection to device.
Exited (sigterm)


Did you find a fix for this? I have been facing it for the last two days. Not on all devices though. A few OnePlus and Xiaomi devices so far.
getCurrentLocation() returns nothing.
Version: 5.1.4
@prsidhu same here, not fix so far.
Same problem here, but the case could be a bit different.
I have geolocator version 5.1.4+2 in my project. When location services are disabled on the device, the getCurrentPosition() method never returns on Android 8 and 9, either with or without Google Play Services.
On Android 10 instead, it throws a PlatformException with INVALID_LOCATION_SETTINGS error code so it's cool for me. I'd expect the same behavior on earlier Android versions, or the method to throw some other exception or at least to return null.
@StijnWoerkom or some other maintainer, please advise. Thanks in advance!
I have same problem. On android emulator api 26 works fine but on real device Redmi Note 7 doesn't work.
i have same problem when grant location access for app but turn off device location service
I think no solution will be here to fix that.
Fixed in version 6.0.0
Fixed in version 6.0.0
It didn't appear to be fixed in 6.0.0+2 but it sure went away in 6.0.0+4. Thank you so much! This was a gnarly bug as it stopped the Android app dead in its tracks. For more debug context, getCurrentPosition would work just fine as soon as the user moved the Google Maps SDK map around, even if just by a pixel. You would think the two flutter packages have nothing to do with each other, right?
Most helpful comment
Same problem here, but the case could be a bit different.
I have
geolocatorversion5.1.4+2in my project. When location services are disabled on the device, thegetCurrentPosition()method never returns on Android 8 and 9, either with or without Google Play Services.On Android 10 instead, it throws a
PlatformExceptionwithINVALID_LOCATION_SETTINGSerror code so it's cool for me. I'd expect the same behavior on earlier Android versions, or the method to throw some other exception or at least to returnnull.@StijnWoerkom or some other maintainer, please advise. Thanks in advance!