所以我实际上遵循这个简单的教程:
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。
这些资源(如教程中提到的)位于我的“assets”文件夹和“fonts”文件夹中。
这些资产是否已损坏或过时?
希望至少有人能解释清楚到底发生了什么。
2条答案
按热度按时间gtlvzcf81#
我相信你还没有把资产文件(如图像和字体)放到你自己的项目中。
基于该教程,您可以下载图像here和字体here。
下载完所有文件后,必须在项目中创建一个名为
assets
的文件夹和一个名为fonts
的文件夹。之后,将所有图像放入
assets
文件夹中,将字体文件放入fonts
文件夹中。并确保您的pubspec.yaml
文件与教程完全相同。所以你的项目应该是这样的:
要了解更多解释,您可以在此处查看教程中的
Defining our assets
部分。c3frrgcw2#
我遇到了这个问题。它是由调用flutter run而没有使用--dart-define =设置环境变量引起的
之后我打电话:
if (apiUrl.isEmpty) { exit(0); }
.这是我的错误,但没有反馈说exit(0)被调用了,所以我花了时间在各种环境下测试。它挂着。