flutter-geolocator icon indicating copy to clipboard operation
flutter-geolocator copied to clipboard

App freeze when launch after killing it

Open MSyarifH opened this issue 3 years ago • 19 comments

🐛 Bug Report

during development process the app running normal, but when i build in release package whenever i close or kill the app and reopen it the app freeze a few second sometime not responding pop up appear

after investigate it, i try remove this plugin and the app running normal, relaunch the app duration not freeze again

Expected behavior

the app launch duration no event 1 second when using this plugin

Reproduction steps

when the app fisrt run from flutter run command

[ +24 ms] D/FlutterGeolocator(12485): Creating service. [ ] D/FlutterGeolocator(12485): Binding to location service. [ +140 ms] D/FlutterGeolocator(12485): Flutter engine connected. Connected engine count 1 [+1914 ms] I/flutter (12485): tokenFCM

the next proses appear after around 1900ms

after i close/ kill the app and open again

[ +15 ms] D/FlutterGeolocator(13118): Creating service. [ ] D/FlutterGeolocator(13118): Binding to location service. [ +28 ms] D/FlutterGeolocator(13118): Flutter engine connected. Connected engine count 1 [+30050 ms] I/flutter (13118): firstRun false

the app freeze around 30000ms until next prosses appear

sometimes like this

[ +14 ms] D/FlutterGeolocator(14467): Creating service. [ +2 ms] D/FlutterGeolocator(14467): Binding to location service. [ +28 ms] D/FlutterGeolocator(14467): Flutter engine connected. Connected engine count 1 [+29560 ms] F/crash_dump64(14560): crash_dump.cpp:509] failed to attach to thread 707: Permission denied [ +507 ms] I/flutter (14467): firstRun false

Configuration

Version:

geolocator: 9.0.2 Flutter Channel stable, 3.7.3, on Microsoft Windows [Version 10.0.22621.1105]

Platform:

  • [ ] :robot: Android

MSyarifH avatar Feb 15 '23 09:02 MSyarifH

update

after closing it and reopen the apps while gps service is on the app freeze but after closing it and reopen the apps while gps service is off the app not freeze

MSyarifH avatar Feb 15 '23 09:02 MSyarifH

update

idk what wrong with my code, but after blindly observe the closed issue i found a solution using this i have try using the newest version of the plugin but sadly still got the error

MSyarifH avatar Feb 15 '23 15:02 MSyarifH

update

idk what wrong with my code, but after blindly observe the closed issue i found a solution using this (not to far from latest plugin version ) i have try using the newest version of the plugin but sadly still got the error

MSyarifH avatar Feb 15 '23 16:02 MSyarifH

I am facing a similar issue. If I try to open the app when location service is enabled then the app is stuck in the splash screen and after a few second the app is force closed by the system. If I turn off location service and launch the app then the app launches fine and doesn't freeze. I am using Geolocator "9.0.2" on Flutter 3.7.3. Android 13 on Oneplus 9 pro.

Please help fix this issue.

bnayagrawal avatar Feb 17 '23 08:02 bnayagrawal

Facing same issue. Any viable solution for this ?

Even after downgrading to lower flutter version (3.0.5) and lower geolocator version, this issue persists.

TusharFA avatar Feb 21 '23 04:02 TusharFA

for @bnayagrawal and @TusharFA have you try using this

dependency_overrides: 
    geolocator: 9.0.1 
    geolocator_android: 4.1.4

mine fixed after add that to pubspec.yaml

MSyarifH avatar Feb 21 '23 07:02 MSyarifH

for @bnayagrawal and @TusharFA have you try using this

dependency_overrides: 
    geolocator: 9.0.1 
    geolocator_android: 4.1.4

mine fixed after add that to pubspec.yaml

this fixed my issues.

alwangk avatar Feb 24 '23 08:02 alwangk

I am use flutter 3.7.5 i need this version of flutter When can we expect an update so that everything works stably for the new flutter?

DmitriySimonov avatar Feb 28 '23 13:02 DmitriySimonov

for @bnayagrawal and @TusharFA have you try using this

dependency_overrides: 
    geolocator: 9.0.1 
    geolocator_android: 4.1.4

mine fixed after add that to pubspec.yaml

Not work on flutter 3.7.x Only flutter 3.3.x

DmitriySimonov avatar Feb 28 '23 13:02 DmitriySimonov

Is there any progress on this?? not working on latest flutter version

singhtaranjeet avatar Mar 10 '23 07:03 singhtaranjeet

I have same issue on Flutter 3.7.7 and Geolocator 9.0.2. For now, I downgrade the plugin to 7.4.0 and the freeze is gone.

nirranthea avatar Mar 28 '23 08:03 nirranthea

Hi @MSyarifH, thank you for taking the time to file this issue!

Can you confirm that this is a problem only on Android? Your issue report also states a Windows version. Is this the computer that is compiling the application? Or are you also experiencing this issue on the Windows platform?

I see many people are experiencing this problem as well. Thanks to everyone weighing in on the situation, providing useful information such as version numbers and workarounds.

Could someone provide a minimal code example that showcases the issue? This would make tracking down the root cause of the bug easier. You can quickly create a minimal code example by creating a new flutter project and tweaking main.dart. Sending the contents of main.dart, or linking a repo, would help tremendously.

JeroenWeener avatar Jun 19 '23 16:06 JeroenWeener

It turned out that the problem was in the library safe_device: ^1.1.4

If you remove the safe_device: ^1.1.4 library, then everything works fine.

These libraries work well!

   geolocator: ^9.0.2
   background_locator_2: ^2.0.6

Flutter 3.10.5 Dart 3.0.5 • DevTools 2.23.1

DmitriySimonov avatar Jun 29 '23 11:06 DmitriySimonov

It turned out that the problem was in the library safe_device: ^1.1.4

If you remove the safe_device: ^1.1.4 library, then everything works fine.

These libraries work well!

   geolocator: ^9.0.2
   background_locator_2: ^2.0.6

Flutter 3.10.5 Dart 3.0.5 • DevTools 2.23.1

Good find. Seems safe_device dependency trust_location may be the issue. It provides location mocking detection (Android only), and can easily be removed while leaving core functionality of package.

anthonyhunter avatar Jul 01 '23 20:07 anthonyhunter

Without additional information, we are unfortunately not able to resolve this issue. Therefore, we reluctantly closed this issue for now. If you run into this issue later, feel free to file a new issue with a reference to this issue. Add a description of detailed steps to reproduce, expected and current behaviour, logs and the output of 'flutter doctor -v'. Thanks for your contribution.

github-actions[bot] avatar Jul 03 '23 16:07 github-actions[bot]

This issues occurs on both android and iOS ... It feels like a deadly threat . The app hungs and throws no error ... First black screen appears before the native splash . In other cases my UI freezes for other pages

crataristo4 avatar Aug 28 '23 06:08 crataristo4

Getting similar kind of problem that @crataristo4 mentioned... I have raise a problem in stackoverflow : https://stackoverflow.com/questions/78059346/flutter-app-not-running-screens-with-third-party-dependencies-no-error-message?noredirect=1#comment137616429_78059346 None of my projects are running.

Anik-Chakraborty avatar Feb 26 '24 18:02 Anik-Chakraborty

Same issue here actually. 1-2 sec freeze on iOS

DennisKragekjaer avatar Apr 18 '24 17:04 DennisKragekjaer

I was remove safe-device from my project and then everything works fine (because safe-device use location service for check mock location)!

miladjalalli avatar Oct 08 '24 16:10 miladjalalli