运行时颤振“与设备失去连接”

Bri*_*Kan 5 debugging connection dart flutter

所以我实际上正在遵循这个简单的教程:

\n

https://pusher.com/tutorials/login-ui-flutter

\n

本教程本身很简单,只需 2 个复制粘贴命令即可完成。

\n

然而,它不起作用!

\n

当我运行它时,它在看似超时后最终崩溃了。

\n

我执行:

\n

flutter clean

\n

flutter upgrade

\n

flutter pub upgrade

\n

flutter pub get

\n

并且问题仍然存在。

\n

这是什么flutter doctor -v返回的内容:

\n
[\xe2\x88\x9a] Flutter (Channel stable, v1.17.4, on Microsoft Windows [Version 10.0.17763.557], locale en-US)\n    \xe2\x80\xa2 Flutter version 1.17.4 at D:\\Program Files\\flutter\n    \xe2\x80\xa2 Framework revision 1ad9baa8b9 (13 days ago), 2020-06-17 14:41:16 -0700\n    \xe2\x80\xa2 Engine revision ee76268252\n    \xe2\x80\xa2 Dart version 2.8.4\n\n\n[\xe2\x88\x9a] Android toolchain - develop for Android devices (Android SDK version 29.0.3)\n    \xe2\x80\xa2 Android SDK at D:\\Program Files\\Android\n    \xe2\x80\xa2 Platform android-29, build-tools 29.0.3\n    \xe2\x80\xa2 ANDROID_HOME = D:\\Program Files\\Android\n    \xe2\x80\xa2 Java binary at: D:\\Program Files\\Android\\Android Studio\\jre\\bin\\java\n    \xe2\x80\xa2 Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)\n    \xe2\x80\xa2 All Android licenses accepted.\n\n[\xe2\x88\x9a] Android Studio (version 4.0)\n    \xe2\x80\xa2 Android Studio at D:\\Program Files\\Android\\Android Studio\n    \xe2\x80\xa2 Flutter plugin version 46.0.2\n    \xe2\x80\xa2 Dart plugin version 193.7361\n    \xe2\x80\xa2 Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)\n\n[\xe2\x88\x9a] VS Code (version 1.46.1)\n    \xe2\x80\xa2 VS Code at C:\\Users\\Brian\\AppData\\Local\\Programs\\Microsoft VS Code\n    \xe2\x80\xa2 Flutter extension version 3.12.1\n\n[\xe2\x88\x9a] Connected device (1 available)\n    \xe2\x80\xa2 sdk gphone x86 \xe2\x80\xa2 emulator-5554 \xe2\x80\xa2 android-x86 \xe2\x80\xa2 Android 10 (API 29) (emulator)\n\n\xe2\x80\xa2 No issues found!\n
Run Code Online (Sandbox Code Playgroud)\n

这是我运行应用程序时来自终端的信息。

\n
Launching lib\\main.dart on sdk gphone x86 in debug mode...\nRunning Gradle task \'assembleDebug\'...\nRunning Gradle task \'assembleDebug\'... Done                        98.6s\n\xe2\x88\x9a Built build\\app\\outputs\\apk\\debug\\app-debug.apk.\nFlutter is taking longer than expected to report its views. Still trying...\nW/.flutterLoginU( 8480): Accessing hidden method Landroid/view/accessibility/AccessibilityNodeInfo;->getSourceNodeId()J (greylist, reflection, allowed)\nW/.flutterLoginU( 8480): Accessing hidden method Landroid/view/accessibility/AccessibilityRecord;->getSourceNodeId()J (greylist, reflection, allowed)\nW/.flutterLoginU( 8480): Accessing hidden field Landroid/view/accessibility/AccessibilityNodeInfo;->mChildNodeIds:Landroid/util/LongArray; (greylist, reflection, allowed)\nW/.flutterLoginU( 8480): Accessing hidden method Landroid/util/LongArray;->get(I)J (greylist, reflection, allowed)\nD/HostConnection( 8480): HostConnection::get() New Host Connection established 0xea497590, tid 8504\nD/HostConnection( 8480): HostConnection::get() New Host Connection established 0xea4947d0, tid 8508\nD/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\nANDROID_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\nGL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0\nW/OpenGLRenderer( 8480): Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...\nD/EGL_emulation( 8480): eglCreateContext: 0xea2a1100: maj 3 min 0 rcv 3\nD/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\nANDROID_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\nGL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0\nD/EGL_emulation( 8480): eglCreateContext: 0xea2a1aa0: maj 3 min 0 rcv 3\nD/EGL_emulation( 8480): eglMakeCurrent: 0xea2a1100: ver 3 0 (tinfo 0xea5e9e70)\nI/Gralloc4( 8480): mapper 4.x is not supported\nD/HostConnection( 8480): createUnique: call\nD/HostConnection( 8480): HostConnection::get() New Host Connection established 0xea494830, tid 8508\nD/eglCodecCommon( 8480): allocate: Ask for block of size 0x100\nD/eglCodecCommon( 8480): allocate: ioctl allocate returned offset 0x3fa729000 size 0x2000\nD/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\nANDROID_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\nGL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0\nD/EGL_emulation( 8480): eglMakeCurrent: 0xea2a1aa0: ver 3 0 (tinfo 0xea5dc5d0)\nSyncing files to device sdk gphone x86...                          294ms\n\nFlutter run key commands.\nr Hot reload.\nR Hot restart.\nh Repeat this help message.\nd Detach (terminate "flutter run" but leave application running).\nc Clear the screen\nq Quit (terminate the application on the device).\nAn Observatory debugger and profiler on sdk gphone x86 is available at: http://127.0.0.1:60961/8gDxLoOdjcw=/\nD/EGL_emulation( 8480): eglMakeCurrent: 0xea2a1100: ver 3 0 (tinfo 0xea5e9e70)\nD/EGL_emulation( 8480): eglMakeCurrent: 0xea2a1aa0: ver 3 0 (tinfo 0xea5dc5d0)\nI/Choreographer( 8480): Skipped 69 frames!  The application may be doing too much work on its main thread.\nE/flutter ( 8480): [ERROR:flutter/third_party/txt/src/minikin/FontFamily.cpp(184)] Could not get cmap table size!\nE/flutter ( 8480):\nF/flutter ( 8480): [FATAL:flutter/third_party/txt/src/minikin/FontCollection.cpp(95)] nTypefaces == 0\nF/libc    ( 8480): Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 8507 (1.ui), pid 8480 (.flutterLoginUI)\n*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***\nBuild fingerprint: \'google/sdk_gphone_x86/generic_x86_arm:10/RPP4.200409.015/6455311:user/release-keys\'\nRevision: \'0\'\nABI: \'x86\'\nTimestamp: 2020-06-30 18:21:02-0400\npid: 8480, tid: 8507, name: 1.ui  >>> com.example.flutterLoginUI <<<\nuid: 10149\nsignal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------\nAbort message: \'[FATAL:flutter/third_party/txt/src/minikin/FontCollection.cpp(95)] nTypefaces == 0\n\'\n    eax 00000000  ebx 00002120  ecx 0000213b  edx 00000006\n    edi e7c40eae  esi b9a949c8\n    ebp ea97ab30  esp b9a94948  eip ea97ab39\nbacktrace:\n      #00 pc 00000b39  [vdso] (__kernel_vsyscall+9)\n      #01 pc 0005b058  /apex/com.android.runtime/lib/bionic/libc.so (syscall+40) (BuildId: f93c954efc24b8a2e43bc3d969ca228c)\n      #02 pc 00076833  /apex/com.android.runtime/lib/bionic/libc.so (abort+195) (BuildId: f93c954efc24b8a2e43bc3d969ca228c)\n      #03 pc 011c5cb1  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)\n      #04 pc 0151f17e  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)\n      #05 pc 0151f328  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)\n      #06 pc 0152b8c8  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)\n      #07 pc 0152b86a  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)\n      #08 pc 0152a01e  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)\n      #09 pc 0152f66c  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)\n      #10 pc 0152efaa  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)\n      #11 pc 015305e1  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)\n      #12 pc 011f1e38  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)\n      #13 pc 011d5d2c  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)\n      #14 pc 011d5cd5  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)\n      #15 pc 011f1a2f  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)\n      #16 pc 016e8b7b  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)\n      #17 pc 016e8ae3  /data/app/~~roUNPjPNMhPfgRiQTZhCWQ==/com.example.flutterLoginUI-Q19ImiC1V8FDjyyBiD9Www==/lib/x86/libflutter.so (BuildId: a29ce163d16aaa44ca6f2b37a93309f890237d82)\n      #18 pc 00000887  <anonymous:b8a00000>\nLost connection to device.\n
Run Code Online (Sandbox Code Playgroud)\n

Flutter 对我来说仍然很新,所以我希望得到任何帮助!

\n

!!!更新 !!!

\n

好吧,所以我还在修修补补然后跑了flutter run -v。\n结果吐出大量信息,但引起我注意的一大块是:

\n
[ +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=/\n[   +1 ms] trying again in a few - 9 more attempts left\n[   +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=/\n[   +1 ms] trying again in a few - 9 more attempts left\n[   +1 ms] Error writing "build/flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf" to DevFS: HttpException: Connection closed before full header was received, uri =\nhttp://127.0.0.1:54240/0kKX1PzwLgQ=/\n[   +1 ms] trying again in a few - 9 more attempts left\n[   +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=/\n[        ] trying again in a few - 9 more attempts left\n[   +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=/\n[        ] trying again in a few - 9 more attempts left\n[        ] 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=/\n[        ] trying again in a few - 9 more attempts left\n
Run Code Online (Sandbox Code Playgroud)\n

实际上,这个问题会随着尝试次数的减少而持续下去,直到达到 0。

\n

我在我的程序中搜索了:flutter_assets但唯一的例子是在我的 gitignore 中。

\n

这些资产(如教程中提到的)位于我的“资产”文件夹和“字体”文件夹中。

\n

这些资产是否已损坏或过时?

\n

希望有人至少可以澄清发生了什么。

\n

his*_*sam 1

我相信您还没有将资源文件(例如图像和字体)放入您自己的项目中。

根据该教程,您可以在此处下载图像,在此处下载字体。

下载所有这些文件后,您必须在项目中创建一个名为 的文件夹assets和一个名为fonts.

之后,将所有图像放入该assets文件夹中,并将字体文件放入该fonts文件夹中。并确保您的pubspec.yaml文件与教程完全相同。

所以你的项目应该是这样的: 在此输入图像描述

如需更多说明,您可以转到此处Defining our assets的教程部分。