Flutter "Lost connection to device" upon running

Viewed 5465

So I'm actually following this simple tutorial from:

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

The tutorial is simplicity itself with 2 copy paste commands and you're done.

HOWEVER, it doesn't work!

When I run it, it ends up crashing after what seems like a time out.

I performed:

flutter clean

flutter upgrade

flutter pub upgrade

flutter pub get

and the problem still persists.

Here is what flutter doctor -v came back with:

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

And here is the info from the terminal when I run the app.

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 is still pretty new to me so I'd appreciate any help!

!!! UPDATE !!!

Alright so I'm still tinkering and ran flutter run -v. The result spat out a ton of info but one chunk that caught my attention was :

[ +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

The issue actually keeps going with the attempts decrementing until it hits 0.

I did a search through my program for: flutter_assets but the ONLY instance of this was in my gitignore.

Those assets (as the tutorial mentions) are in my "assets" folder and "fonts" folder.

Are these assets corrupted or outdated??

Hopefully someone can at least clarify what's going on.

1 Answers

I believe that you haven't put the assets file (such as the image and fonts) into your own project.

Based on that tutorial, you can download the images here, and the font here.

After you download all of them, you have to create a folder inside your project called assets and a folder called fonts.

After that, put all the images inside the assets folder and the font file inside the fonts folder. And make sure your pubspec.yaml file is exactly the same as the tutorial.

So your project should be like: enter image description here

For more explanations, you can head over to the Defining our assets section on the tutorial here.

Related