flutter - 运行时 flutter “Lost connection to device”

标签 flutter debugging dart connection

所以我实际上是从以下简单的教程开始的:
https://pusher.com/tutorials/login-ui-flutter
本教程本身就是简单的,带有2个复制粘贴命令,您已完成。
但是,它不起作用!
当我运行它时,它似乎在超时后崩溃了。
我执行了:flutter cleanflutter upgradeflutter pub upgradeflutter pub get而且问题仍然存在。
这是flutter doctor -v返回的内容:

[√] Flutter (Channel stable, v1.17.4, on Microsoft Windows [Version 10.0.17763.557], locale en-US)
    • Flutter version 1.17.4 at D:\Program Files\flutter
    • Framework revision 1ad9baa8b9 (13 days ago), 2020-06-17 14:41:16 -0700
    • Engine revision ee76268252
    • Dart version 2.8.4


[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at D:\Program Files\Android
    • Platform android-29, build-tools 29.0.3
    • ANDROID_HOME = D:\Program Files\Android
    • Java binary at: D:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Android Studio (version 4.0)
    • Android Studio at D:\Program Files\Android\Android Studio
    • Flutter plugin version 46.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.46.1)
    • VS Code at C:\Users\Brian\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.12.1

[√] Connected device (1 available)
    • sdk gphone x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

• No issues found!
这是我运行应用程序时来自终端的信息。
Launching lib\main.dart on sdk gphone x86 in debug mode...
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                        98.6s
√ Built build\app\outputs\apk\debug\app-debug.apk.
Flutter is taking longer than expected to report its views. Still trying...
W/.flutterLoginU( 8480): Accessing hidden method Landroid/view/accessibility/AccessibilityNodeInfo;->getSourceNodeId()J (greylist, reflection, allowed)
W/.flutterLoginU( 8480): Accessing hidden method Landroid/view/accessibility/AccessibilityRecord;->getSourceNodeId()J (greylist, reflection, allowed)
W/.flutterLoginU( 8480): Accessing hidden field Landroid/view/accessibility/AccessibilityNodeInfo;->mChildNodeIds:Landroid/util/LongArray; (greylist, reflection, allowed)
W/.flutterLoginU( 8480): Accessing hidden method Landroid/util/LongArray;->get(I)J (greylist, reflection, allowed)
D/HostConnection( 8480): HostConnection::get() New Host Connection established 0xea497590, tid 8504
D/HostConnection( 8480): HostConnection::get() New Host Connection established 0xea4947d0, tid 8508
D/HostConnection( 8480): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem
ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_vulkan_free_memory_sync GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object
GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0
W/OpenGLRenderer( 8480): Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
D/EGL_emulation( 8480): eglCreateContext: 0xea2a1100: maj 3 min 0 rcv 3
D/HostConnection( 8480): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem
ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_vulkan_free_memory_sync GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object
GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0
D/EGL_emulation( 8480): eglCreateContext: 0xea2a1aa0: maj 3 min 0 rcv 3
D/EGL_emulation( 8480): eglMakeCurrent: 0xea2a1100: ver 3 0 (tinfo 0xea5e9e70)
I/Gralloc4( 8480): mapper 4.x is not supported
D/HostConnection( 8480): createUnique: call
D/HostConnection( 8480): HostConnection::get() New Host Connection established 0xea494830, tid 8508
D/eglCodecCommon( 8480): allocate: Ask for block of size 0x100
D/eglCodecCommon( 8480): allocate: ioctl allocate returned offset 0x3fa729000 size 0x2000
D/HostConnection( 8480): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem
ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_vulkan_free_memory_sync GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object
GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0
D/EGL_emulation( 8480): eglMakeCurrent: 0xea2a1aa0: ver 3 0 (tinfo 0xea5dc5d0)
Syncing files to device sdk gphone x86...                          294ms

Flutter run key commands.
r Hot reload.
R Hot restart.
h Repeat this help message.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
An Observatory debugger and profiler on sdk gphone x86 is available at: http://127.0.0.1:60961/8gDxLoOdjcw=/
D/EGL_emulation( 8480): eglMakeCurrent: 0xea2a1100: ver 3 0 (tinfo 0xea5e9e70)
D/EGL_emulation( 8480): eglMakeCurrent: 0xea2a1aa0: ver 3 0 (tinfo 0xea5dc5d0)
I/Choreographer( 8480): Skipped 69 frames!  The application may be doing too much work on its main thread.
E/flutter ( 8480): [ERROR:flutter/third_party/txt/src/minikin/FontFamily.cpp(184)] Could not get cmap table size!
E/flutter ( 8480):
F/flutter ( 8480): [FATAL:flutter/third_party/txt/src/minikin/FontCollection.cpp(95)] nTypefaces == 0
F/libc    ( 8480): Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 8507 (1.ui), pid 8480 (.flutterLoginUI)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/sdk_gphone_x86/generic_x86_arm:10/RPP4.200409.015/6455311:user/release-keys'
Revision: '0'
ABI: 'x86'
Timestamp: 2020-06-30 18:21:02-0400
pid: 8480, tid: 8507, name: 1.ui  >>> com.example.flutterLoginUI <<<
uid: 10149
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
Abort message: '[FATAL:flutter/third_party/txt/src/minikin/FontCollection.cpp(95)] nTypefaces == 0
'
    eax 00000000  ebx 00002120  ecx 0000213b  edx 00000006
    edi e7c40eae  esi b9a949c8
    ebp ea97ab30  esp b9a94948  eip ea97ab39
backtrace:
      #00 pc 00000b39  [vdso] (__kernel_vsyscall+9)
      #01 pc 0005b058  /apex/com.android.runtime/lib/bionic/libc.so (syscall+40) (BuildId: f93c954efc24b8a2e43bc3d969ca228c)
      #02 pc 00076833  /apex/com.android.runtime/lib/bionic/libc.so (abort+195) (BuildId: f93c954efc24b8a2e43bc3d969ca228c)
      #03 pc 011c5cb1  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)
      #04 pc 0151f17e  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)
      #05 pc 0151f328  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)
      #06 pc 0152b8c8  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)
      #07 pc 0152b86a  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)
      #08 pc 0152a01e  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)
      #09 pc 0152f66c  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)
      #10 pc 0152efaa  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)
      #11 pc 015305e1  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)
      #12 pc 011f1e38  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)
      #13 pc 011d5d2c  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)
      #14 pc 011d5cd5  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)
      #15 pc 011f1a2f  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)
      #16 pc 016e8b7b  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)
      #17 pc 016e8ae3  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)
      #18 pc 00000887  <anonymous:b8a00000>
Lost connection to device.
Flutter对我来说还是很新的,所以我将不胜感激!
!!!更新!
好吧,所以我仍然在修补和运行flutter run -v
结果吐出了大量信息,但是吸引了我注意的是:
[ +100 ms] Error writing "build/flutter_assets/assets/logo.png" to DevFS: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:54240/0kKX1PzwLgQ=/
[   +1 ms] trying again in a few - 9 more attempts left
[   +1 ms] Error writing "build/flutter_assets/fonts/Montserrat-Regular.ttf" to DevFS: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:54240/0kKX1PzwLgQ=/
[   +1 ms] trying again in a few - 9 more attempts left
[   +1 ms] Error writing "build/flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf" to DevFS: HttpException: Connection closed before full header was received, uri =
http://127.0.0.1:54240/0kKX1PzwLgQ=/
[   +1 ms] trying again in a few - 9 more attempts left
[   +1 ms] Error writing "build/flutter_assets/fonts/MaterialIcons-Regular.ttf" to DevFS: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:54240/0kKX1PzwLgQ=/
[        ] trying again in a few - 9 more attempts left
[   +1 ms] Error writing "build/flutter_assets/AssetManifest.json" to DevFS: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:54240/0kKX1PzwLgQ=/
[        ] trying again in a few - 9 more attempts left
[        ] Error writing "build/flutter_assets/FontManifest.json" to DevFS: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:54240/0kKX1PzwLgQ=/
[        ] trying again in a few - 9 more attempts left
实际上,问题一直伴随着尝试递减直到达到0。
我在程序中搜索了flutter_assets,但它的唯一实例在我的gitignore中。
这些 Assets (如本教程所述)位于我的“ Assets ”文件夹和“字体”文件夹中。
这些 Assets 是否已损坏或过时?
希望有人至少可以澄清发生了什么。

最佳答案

我相信您尚未将 Assets 文件(例如图像和字体)放入自己的项目中。
根据该教程,您可以下载图像here和字体here
下载所有这些文件后,必须在项目内部创建一个名为assets的文件夹和一个名为fonts的文件夹。
之后,将所有图像放入assets文件夹中,并将字体文件放入fonts文件夹中。并确保您的pubspec.yaml文件与本教程完全相同。
因此,您的项目应类似于:
enter image description here
有关更多说明,您可以转到here教程上的Defining our assets部分。

关于flutter - 运行时 flutter “Lost connection to device”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62667117/

相关文章:

math - Dart - 查找函数中的所有根

flutter - 测量两个位置之间的距离

flutter - 使用 Provider 和模型类搜索/过滤 ListView

c++ - VC++调试: is it possible to skip cursor?

c - Atmel Studio 7 不显示任何调试工具

angularjs - Angulardart:替代ng-repeat-start吗?

flutter - 在不同屏幕的自定义导航栏中更改所选项目的颜色

flutter - PlatformException(400,HTTP状态码错误。,null)

flutter - 如何在 Flutter 中忽略整个文件的 lint 规则?

xcode - Swift 拖放在 Xcode 之外不起作用