首页 > 解决方案 > Flutter 应用程序在第二次打开时在调试时突然关闭

问题描述

我有一个大问题,应用程序在第二次打开后突然关闭。

这是上下文和日志:

当你打开应用程序时,我和我的朋友正在制作一个带有位置服务的颤振应用程序。

一切都按预期工作,然后我们离开应用程序 1 个月以在应用程序的网站上工作,然后我们尝试再次运行最后一个构建,这就是发生的事情(日志在这里):

/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

我尝试了多种方法,例如:

需要考虑的一件事:

这只发生在android上,当我第二次打开应用程序时,如果我在android上删除应用程序的缓存和存储文件,应用程序会要求再次使用GPS并正常工作,但是在你第二次打开它之后时间再次发生。

感谢任何可以提供帮助的人。

颤振医生:

[√] 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

标签: flutter

解决方案


这主要是由于颤振的内部 api 更改导致的渲染问题。尝试运行它

flutter run --enable-software-renderin

您也可以尝试更改模拟器设置,如此处所述


推荐阅读