在模拟器上运行flutter app抛出Could not update files on device: HttpException异常

在mumu模拟器上运行flutter app,启动的时候闪退,日志如下:

I/OpenGLRenderer( 9665): Initialized EGL, version 1.4
D/        ( 9665): HostConnection::get() New Host Connection established 0xa0642dc0, tid 9708
D/        ( 9665): HostConnection::get() New Host Connection established 0xa067e620, tid 9683
W/EGL_emulation( 9665): eglSurfaceAttrib not implemented
W/OpenGLRenderer( 9665): Failed to set EGL_SWAP_BEHAVIOR on surface 0xadeb1480, error=EGL_SUCCESS
E/flutter ( 9665): [ERROR:flutter/shell/gpu/gpu_surface_gl.cc(64)] Failed to setup Skia Gr context.
F/libc    ( 9665): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 9683 (1.gpu)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'OnePlus/OnePlus2/OnePlus2:6.0.1/MMB29M/1447841200:user/release-keys'
Revision: '0'
ABI: 'x86'
pid: 9665, tid: 9683, name: 1.gpu  >>> com.example.flutter_app <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
    eax 00000000  ebx a30f6bbc  ecx 00000000  edx 00000000
    esi b3b39960  edi a158a538
    xcs 00000073  xds 0000007b  xes 0000007b  xfs 0000003b  xss 0000007b
    eip a27e0b52  ebp a158a528  esp a158a4e0  flags 00210246
backtrace:
    #00 pc 01156b52  /data/app/com.example.flutter_app-1/lib/x86/libflutter.so (offset 0x10fb000)
    #01 pc 0115b662  /data/app/com.example.flutter_app-1/lib/x86/libflutter.so (offset 0x10fb000)
    #02 pc 01160012  /data/app/com.example.flutter_app-1/lib/x86/libflutter.so (offset 0x10fb000)
    #03 pc 01114729  /data/app/com.example.flutter_app-1/lib/x86/libflutter.so (offset 0x10fb000)
    #04 pc 01116ce8  /data/app/com.example.flutter_app-1/lib/x86/libflutter.so (offset 0x10fb000)
    #05 pc 01116c2a  /data/app/com.example.flutter_app-1/lib/x86/libflutter.so (offset 0x10fb000)
    #06 pc 0111d678  /data/app/com.example.flutter_app-1/lib/x86/libflutter.so (offset 0x10fb000)
    #07 pc 0111d6a6  /data/app/com.example.flutter_app-1/lib/x86/libflutter.so (offset 0x10fb000)
    #08 pc 00018fd2  /system/lib/libutils.so (_ZN7android20SimpleLooperCallback11handleEventEiiPv+32)
    #09 pc 0001afd9  /system/lib/libutils.so (_ZN7android6Looper9pollInnerEi+409)
    #10 pc 0001b327  /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+53)
    #11 pc 0000a1d1  /system/lib/libandroid.so (ALooper_pollOnce+96)
    #12 pc 0111d5b5  /data/app/com.example.flutter_app-1/lib/x86/libflutter.so (offset 0x10fb000)
    #13 pc 01116bd8  /data/app/com.example.flutter_app-1/lib/x86/libflutter.so (offset 0x10fb000)
    #14 pc 0111674a  /data/app/com.example.flutter_app-1/lib/x86/libflutter.so (offset 0x10fb000)
    #15 pc 0111accf  /data/app/com.example.flutter_app-1/lib/x86/libflutter.so (offset 0x10fb000)
    #16 pc 000811d1  /system/lib/libc.so (_ZL15__pthread_startPv+56)
    #17 pc 0002174e  /system/lib/libc.so (__start_thread+25)
    #18 pc 00016ea6  /system/lib/libc.so (__bionic_clone+70)
Tombstone written to: /data/tombstones/tombstone_01
Lost connection to device.
Could not update files on device: HttpException: Connection closed before full header was received, uri =
http://127.0.0.1:52250/eWzgEbUU3S4=/
Syncing files to device MuMu...

在终端执行 flutter run --enable-software-rendering即可,运行 flutter help run可以看出该参数的含义是:

Run your Flutter app on an attached device.

Usage: flutter run [arguments]
-h, --help                                   Print this usage information.
    --debug                                  Build a debug version of your app (default mode).
    --profile                                Build a version of your app specialized for performance profiling.
    --release                                Build a release version of your app.
    --flavor                                 Build a custom app flavor as defined by platform-specific build setup.
                                             Supports the use of product flavors in Android Gradle scripts, and the use
                                             of custom Xcode schemes.

    --trace-startup                          Trace application startup, then exit, saving the trace to a file.
    --verbose-system-logs                    Include verbose logging from the flutter engine.
    --route                                  Which route to load when running the app.
-t, --target=                          The main entry-point file of the application, as run on the device.
                                             If the --target option is omitted, but a file name is provided on the
                                             command line, then that is used instead.
                                             (defaults to "lib\main.dart")

    --observatory-port                       Listen to the given port for an observatory debugger connection.
                                             Specifying port 0 (the default) will find a random free port.

    --[no-]pub                               Whether to run "flutter pub get" before executing this command.
                                             (defaults to on)

    --[no-]track-widget-creation             Track widget creation locations. This enables features such as the widget
                                             inspector. This parameter is only functional in debug mode (i.e. when
                                             compiling JIT, not AOT).

    --start-paused                           Start in a paused mode and wait for a debugger to connect.
    --enable-software-rendering              Enable rendering using the Skia software backend. This is useful when
                                             testing Flutter on emulators. By default, Flutter will attempt to either
                                             use OpenGL or Vulkan and fall back to software when neither is available.

    --skia-deterministic-rendering           When combined with --enable-software-rendering, provides 100% deterministic
                                             Skia rendering.

    --trace-skia                             Enable tracing of Skia code. This is useful when debugging the GPU thread.
                                             By default, Flutter will not log skia code.

    --trace-systrace                         Enable tracing to the system tracer. This is only useful on platforms where
                                             such a tracer is available (Android and Fuchsia).

    --dump-skp-on-shader-compilation         Automatically dump the skp that triggers new shader compilations. This is
                                             useful for wrting custom ShaderWarmUp to reduce jank. By default, this is
                                             not enabled to reduce the overhead. This is only available in profile or
                                             debug build.

    --[no-]await-first-frame-when-tracing    Whether to wait for the first frame when tracing startup
                                             ("--trace-startup"), or just dump the trace as soon as the application is
                                             running. The first frame is detected by looking for a Timeline event with
                                             the name "Rasterized first useful frame". By default, the widgets library's
                                             binding takes care of sending this event.
                                             (defaults to on)

    --[no-]use-test-fonts                    Enable (and default to) the "Ahem" font. This is a special font used in
                                             tests to remove any dependencies on the font metrics. It is enabled when
                                             you use "flutter test". Set this flag when running a test using "flutter
                                             run" for debugging purposes. This flag is only available when running in
                                             debug mode.

    --[no-]build                             If necessary, build the app before running.
                                             (defaults to on)

    --[no-]hot                               Run with support for hot reloading. Only available for debug mode. Not
                                             available with "--trace-startup".
                                             (defaults to on)

    --pid-file                               Specify a file to write the process id to. You can send SIGUSR1 to trigger
                                             a hot reload and SIGUSR2 to trigger a hot restart.

Run "flutter help" to see global options.

你可能感兴趣的:(前端,Android)