运行时颤振“与设备的连接丢失”
Posted
技术标签:
【中文标题】运行时颤振“与设备的连接丢失”【英文标题】:Flutter "Lost connection to device" upon running 【发布时间】:2020-10-21 07:51:45 【问题描述】:所以我实际上是在遵循这个简单的教程:
https://pusher.com/tutorials/login-ui-flutter
本教程本身很简单,只需 2 个复制粘贴命令即可完成。
但是,它不起作用!
当我运行它时,它似乎在超时后崩溃了。
我表演了:
flutter clean
flutter upgrade
flutter pub upgrade
flutter 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 中。
这些资产(如教程所述)位于我的“资产”文件夹和“字体”文件夹中。
这些资产是否已损坏或过时??
希望有人至少可以澄清发生了什么。
【问题讨论】:
运气好吗?按F5
时,我在 VSCode 中遇到了同样的问题。 flutter run
工作正常!
不,恐怕没有运气。感谢大家的尝试!
【参考方案1】:
相信你还没有将assets文件(比如图片和字体)放到自己的项目中。
根据该教程,您可以下载图片here,字体here。
下载所有文件后,您必须在项目中创建一个名为 assets
的文件夹和一个名为 fonts
的文件夹。
之后,将所有图像放在assets
文件夹中,将字体文件放在fonts
文件夹中。并确保您的 pubspec.yaml
文件与教程完全相同。
所以你的项目应该是这样的:
如需更多解释,您可以前往教程here 上的Defining our assets
部分。
【讨论】:
您好,感谢您的回复。我确实从一开始就将资产和字体放在了它们各自的文件夹中。所以好像不是这样。我也会看看你的教程 您找到解决方案了吗? 不,遗憾的是没有,不得不转移到其他项目。以上是关于运行时颤振“与设备的连接丢失”的主要内容,如果未能解决你的问题,请参考以下文章
当 cached_network_image 或 Image.Network 填充数据时,Flutter 应用程序崩溃很多,仅显示与设备的连接丢失而已
当我尝试运行颤振医生 --android-licenses 时出错