Flutter app suddenly closes on debug on the second open

Viewed 260

I have a big problem that the app closes suddenly after a second open.

here is the context and log:

me and my friend are making a flutter app with location services when you open the app.

everything was working as expected, then we left the app for 1 month to work on the website of the app, and then we tried to run again the last build and this is what hapenned (log post here):

/NetworkRequest( 5689): No App Check token for request.
D/skia    ( 5689):    1 Shader compilation error
D/skia    ( 5689):    2 ------------------------
D/skia    ( 5689):    3 Errors:
D/skia    ( 5689):    4
D/EGL_emulation( 5689): eglMakeCurrent: 0xd521a300: ver 3 0 (tinfo 0xd52d4490)
E/libEGL  ( 5689): call to OpenGL ES API with no current context (logged once per thread)
D/FlutterLocationService( 5689): Unbinding from location service.
D/FlutterLocationService( 5689): Destroying service.
W/FlutterJNI( 5689): Tried to send a platform message response, but FlutterJNI was detached from native C++. Could not send. Response ID: 21

I have tried multiple things such as:

  • Flutter pub upgrade
  • Upgrade flutter
  • Updating Gradle
  • Updating java JDE and JDK

One thing to consider:

This only happens on android and when i open the app for the second time, if i delete cache and storage files of the app on android, the app ask for permissions to use GPS again and work normally, but after you open it for the second time it happens again.

Thanks for anyone who can help.

Flutter doctor:

[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Versión 10.0.19042.1110], locale es-CL)
    • Flutter version 2.2.3 at C:\flutter
    • Framework revision f4abaa0735 (2 weeks ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4       

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at C:\Users\nico\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java      
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)   
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.1.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)

[√] VS Code (version 1.58.2)
    • VS Code at C:\Users\nico\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.24.0

[√] Connected device (3 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86    • Android 10 (API 29) (emulator)
    • Chrome (web)                       • chrome        • web-javascript • Google Chrome 91.0.4472.124
    • Edge (web)                         • edge          • web-javascript • Microsoft Edge 91.0.864.67
1 Answers

It happens mostly because of rendering issue due to flutter's internal api changes. Try running it with

flutter run --enable-software-renderin

You can also try changing emulator settings like stated here

Related