stu*_*sad 11 console android archlinux flutter hot-reload
我想使用 flutter 开发 Android 应用程序,而不使用 Android Studio 或其他 IDE。我目前正在基于 arch 的 Linux 发行版上安装所有内容。除了热重载功能之外,一切对我来说都运行良好。当我这样做flutter run
(甚至flutter run --hot
)时,命令执行会卡在以下位置:
$ flutter run --hot \xee\x82\xb2 \xe2\x9c\x94 \xee\x82\xb2 926 \xee\x82\xb2 10:53:42\nUsing hardware rendering with device AOSP on IA Emulator. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering".\nLaunching lib/main.dart on AOSP on IA Emulator in debug mode...\nRunning Gradle task \'assembleDebug\'... 16.0s\n\xe2\x9c\x93 Built build/app/outputs/apk/debug/app-debug.apk.\nInstalling build/app/outputs/apk/app.apk... 2.1s\nD/FlutterActivity( 5356): Using the launch theme as normal theme.\nD/FlutterActivityAndFragmentDelegate( 5356): Setting up FlutterEngine.\nD/FlutterActivityAndFragmentDelegate( 5356): No preferred FlutterEngine was provided. Creating a new FlutterEngine for this FlutterFragment.\nD/FlutterActivityAndFragmentDelegate( 5356): Attaching FlutterEngine to the Activity that owns this Fragment.\nD/FlutterView( 5356): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@a4c3a46\nD/FlutterActivityAndFragmentDelegate( 5356): Executing Dart entrypoint: main, and sending initial route: /\nSyncing files to device AOSP on IA Emulator...\nI/Choreographer( 5356): Skipped 39 frames! The application may be doing too much work on its main thread.\n\nD/EGL_emulation( 5356): eglMakeCurrent: 0xee21eda0: ver 2 0 (tinfo 0xebee8750)\n\nI/OpenGLRenderer( 5356): Davey! duration=855ms; Flags=1, IntendedVsync=1732977740059, Vsync=1733627740033, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=1733631371135, AnimationStart=1733631552307, PerformTraversalsStart=1733631557297, DrawStart=1733706388536, SyncQueued=1733709834031, SyncStart=1733711094512, IssueDrawCommandsStart=1733711517055, SwapBuffers=1733737182985, FrameCompleted=1733834775355, DequeueBufferDuration=28144000, QueueBufferDuration=9171000,\n\nD/EGL_emulation( 5356): eglMakeCurrent: 0xec205360: ver 2 0 (tinfo 0xec2033b0)\n\nD/eglCodecCommon( 5356): setVertexArrayObject: set vao to 0 (0) 1 0\n
Run Code Online (Sandbox Code Playgroud)\n\n我所说的卡住是指该程序只是输出日志消息并忽略我的所有输入。我已经尝试过按r
或之类的东西R
,但它只会导致
D/eglCodecCommon( 5356): setVertexArrayObject: set vao to 0 (0) 1 0\nrR\n
Run Code Online (Sandbox Code Playgroud)\n\n并且模拟设备没有反应。
\n\n如果您有兴趣,这里有一些输出:
\n\nflutter doctor
结果是:
[\xe2\x9c\x93] Flutter (Channel stable, v1.12.13+hotfix.8, on Linux, locale en_US.UTF-8)\n \xe2\x80\xa2 Flutter version 1.12.13+hotfix.8 at /opt/flutter\n \xe2\x80\xa2 Framework revision 0b8abb4724 (4 weeks ago), 2020-02-11 11:44:36 -0800\n \xe2\x80\xa2 Engine revision e1e6ced81d\n \xe2\x80\xa2 Dart version 2.7.0\n\n[\xe2\x9c\x93] Android toolchain - develop for Android devices (Android SDK version 28.0.3)\n \xe2\x80\xa2 Android SDK at /opt/android-sdk\n \xe2\x80\xa2 Android NDK location not configured (optional; useful for native profiling support)\n \xe2\x80\xa2 Platform android-28, build-tools 28.0.3\n \xe2\x80\xa2 ANDROID_HOME = /opt/android-sdk\n \xe2\x80\xa2 Java binary at: /usr/bin/java\n \xe2\x80\xa2 Java version OpenJDK Runtime Environment (build 1.8.0_242-b08)\n \xe2\x80\xa2 All Android licenses accepted.\n\n[!] Android Studio (not installed)\n \xe2\x80\xa2 Android Studio not found; download from https://developer.android.com/studio/index.html\n (or visit https://flutter.dev/setup/#android-setup for detailed instructions).\n\n[\xe2\x9c\x93] Connected device (1 available)\n \xe2\x80\xa2 AOSP on IA Emulator \xe2\x80\xa2 emulator-5554 \xe2\x80\xa2 android-x86 \xe2\x80\xa2 Android 9 (API 28) (emulator)\n
Run Code Online (Sandbox Code Playgroud)\n\n由于已请求,这里是输出的最后一部分flutter run -v
:
[ +23 ms] Android Debug Bridge version 1.0.41\n Version 29.0.6-6198805\n Installed as /opt/android-sdk/platform-tools/adb\n[ +1 ms] executing: /opt/android-sdk/platform-tools/adb start-server\n[ +19 ms] Installing build/app/outputs/apk/app.apk...\n[ ] executing: /opt/android-sdk/platform-tools/adb -s emulator-5554 install -t -r /home/fox/tmp/testy/build/app/outputs/apk/app.apk\n[+2544 ms] Performing Streamed Install\n Success\n[ ] Installing build/app/outputs/apk/app.apk... (completed in 2.5s)\n[ +4 ms] executing: /opt/android-sdk/platform-tools/adb -s emulator-5554 shell echo -n d26fd49fc8a8132a5b3be06672c852791523c0be > /data/local/tmp/sky.com.example.testy.sha1\n[ +92 ms] AOSP on IA Emulator startApp\n[ +4 ms] executing: /opt/android-sdk/platform-tools/adb -s emulator-5554 shell am start -a android.intent.action.RUN -f 0x20000000 --ez enable-background-compilation true --ez enable-dart-profiling\ntrue --ez enable-checked-mode true --ez verify-entry-points true com.example.testy/com.example.testy.MainActivity\n[ +379 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000 cmp=com.example.testy/.MainActivity (has extras) }\n[ +1 ms] Waiting for observatory port to be available...\n[+1187 ms] D/FlutterActivity( 5901): Using the launch theme as normal theme.\n[ +5 ms] D/FlutterActivityAndFragmentDelegate( 5901): Setting up FlutterEngine.\n[ ] D/FlutterActivityAndFragmentDelegate( 5901): No preferred FlutterEngine was provided. Creating a new FlutterEngine for this FlutterFragment.\n[+1996 ms] D/FlutterActivityAndFragmentDelegate( 5901): Attaching FlutterEngine to the Activity that owns this Fragment.\n[ +95 ms] D/FlutterView( 5901): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@a4c3a46\n[ +54 ms] D/FlutterActivityAndFragmentDelegate( 5901): Executing Dart entrypoint: main, and sending initial route: /\n[ +140 ms] Observatory URL on device: http://127.0.0.1:34706/KylafuV8tWY=/\n[ +3 ms] executing: /opt/android-sdk/platform-tools/adb -s emulator-5554 forward tcp:0 tcp:34706\n[ +14 ms] 44911\n[ ] Forwarded host port 44911 to device port 34706 for Observatory\n[ +12 ms] Connecting to service protocol: http://127.0.0.1:44911/KylafuV8tWY=/\n[ +698 ms] Successfully connected to service protocol: http://127.0.0.1:44911/KylafuV8tWY=/\n[ +5 ms] Sending to VM service: getVM({})\n[ +20 ms] Result: {type: VM, name: vm, architectureBits: 32, hostCPU: Android virtual processor, operatingSystem: android, targetCPU: ia32, version: 2.7.0 (Fri Dec 6 16:26:51 2019 +0100) on\n"android_ia32", _profilerMode: VM, _nativeZoneMemoryUsage: 0, pid: 5901, st...\n[ +14 ms] Sending to VM service: getIsolate({isolateId: isolates/2827659313742019})\n[ +11 ms] Sending to VM service: _flutter.listViews({})\n[ +76 ms] Result: {type: Isolate, id: isolates/2827659313742019, name: main, number: 2827659313742019, _originNumber: 2827659313742019, startTime: 1584009467451, _heaps: {new: {type: HeapSpace,\nname: new, vmName: Scavenger, collections: 2, avgCollectionPeriodMillis...\n[ +30 ms] Result: {type: FlutterViewList, views: [{type: FlutterView, id: _flutterView/0xebf68710, isolate: {type: @Isolate, fixedId: true, id: isolates/2827659313742019, name:\nmain.dart$main-2827659313742019, number: 2827659313742019}}]}\n[ +25 ms] DevFS: Creating new filesystem on the device (null)\n[ +2 ms] Sending to VM service: _createDevFS({fsName: testy})\n[ +58 ms] Result: {type: FileSystem, name: testy, uri: file:///data/user/0/com.example.testy/code_cache/testyTKZBNK/testy/}\n[ ] DevFS: Created new filesystem on the device (file:///data/user/0/com.example.testy/code_cache/testyTKZBNK/testy/)\n[ +2 ms] Updating assets\n[ +137 ms] Syncing files to device AOSP on IA Emulator...\n[ +3 ms] Scanning asset files\n[ +3 ms] <- reset\n[ ] Compiling dart to kernel with 0 updated files\n[ +12 ms] /opt/flutter/bin/cache/dart-sdk/bin/dart /opt/flutter/bin/cache/artifacts/engine/linux-x64/frontend_server.dart.snapshot --sdk-root\n/opt/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --incremental --target=flutter -Ddart.developer.causal_async_stacks=true --output-dill /tmp/flutter_tool.RFJESY/app.dill --packages\n/home/fox/tmp/testy/.packages -Ddart.vm.profile=false -Ddart.vm.product=false\n--bytecode-options=source-positions,local-var-info,debugger-stops,instance-field-initializers,keep-unreachable-code,avoid-closure-call-instructions --enable-asserts --track-widget-creation\n--filesystem-scheme org-dartlang-root\n[ +20 ms] <- compile package:testy/main.dart\n[ +69 ms] D/EGL_emulation( 5901): eglMakeCurrent: 0xee21f400: ver 2 0 (tinfo 0xee22aaf0)\n[ +5 ms] D/eglCodecCommon( 5901): setVertexArrayObject: set vao to 0 (0) 1 0\n
Run Code Online (Sandbox Code Playgroud)\n\n的输出flutter devices -v
是
$ flutter devices -v \xee\x82\xb2 \xe2\x9c\x94 \xee\x82\xb2 936 \xee\x82\xb2 14:29:36\n[ +14 ms] executing: [/opt/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H\n[ +40 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H\n[ ] 0b8abb4724aa590dd0f429683339b1e045a1594d\n[ ] executing: [/opt/flutter/] git describe --match v*.*.* --first-parent --long --tags\n[ +9 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags\n[ ] v1.12.13+hotfix.8-0-g0b8abb472\n[ +8 ms] executing: [/opt/flutter/] git rev-parse --abbrev-ref --symbolic @{u}\n[ +8 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}\n[ ] origin/stable\n[ ] executing: [/opt/flutter/] git ls-remote --get-url origin\n[ +7 ms] Exit code 0 from: git ls-remote --get-url origin\n[ ] https://github.com/flutter/flutter.git\n[ +68 ms] executing: [/opt/flutter/] git rev-parse --abbrev-ref HEAD\n[ +11 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD\n[ ] stable\n[ +41 ms] Artifact Instance of \'AndroidMavenArtifacts\' is not required, skipping update.\n[ ] Artifact Instance of \'AndroidGenSnapshotArtifacts\' is not required, skipping update.\n[ ] Artifact Instance of \'AndroidInternalBuildArtifacts\' is not required, skipping update.\n[ ] Artifact Instance of \'IOSEngineArtifacts\' is not required, skipping update.\n[ ] Artifact Instance of \'FlutterWebSdk\' is not required, skipping update.\n[ +5 ms] Artifact Instance of \'WindowsEngineArtifacts\' is not required, skipping update.\n[ ] Artifact Instance of \'MacOSEngineArtifacts\' is not required, skipping update.\n[ ] Artifact Instance of \'LinuxEngineArtifacts\' is not required, skipping update.\n[ ] Artifact Instance of \'LinuxFuchsiaSDKArtifacts\' is not required, skipping update.\n[ ] Artifact Instance of \'MacOSFuchsiaSDKArtifacts\' is not required, skipping update.\n[ ] Artifact Instance of \'FlutterRunnerSDKArtifacts\' is not required, skipping update.\n[ ] Artifact Instance of \'FlutterRunnerDebugSymbols\' is not required, skipping update.\n[ +83 ms] executing: /opt/android-sdk/platform-tools/adb devices -l\n[ +18 ms] Exit code 0 from: /opt/android-sdk/platform-tools/adb devices -l\n[ ] List of devices attached\n emulator-5554 device product:sdk_gphone_x86_arm model:AOSP_on_IA_Emulator device:generic_x86_arm transport_id:4\n[ +36 ms] 1 connected device:\n\n[ +14 ms] /opt/android-sdk/platform-tools/adb -s emulator-5554 shell getprop\n[ +87 ms] ro.hardware = ranchu\n[ +6 ms] AOSP on IA Emulator \xe2\x80\xa2 emulator-5554 \xe2\x80\xa2 android-x86 \xe2\x80\xa2 Android 9 (API 28) (emulator)\n[ +15 ms] "flutter devices" took 320ms.\n
Run Code Online (Sandbox Code Playgroud)\n
Rém*_*let 29
该命令没有“卡住”。它不会结束,直到您退出应用程序,并且它捕获输入以便能够触发某些操作。
在此状态下,键入以下任意字母以触发特定操作:
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).
s Save a screenshot to flutter.png.
w Dump widget hierarchy to the console. (debugDumpApp)
t Dump rendering tree to the console. (debugDumpRenderTree)
L Dump layer tree to the console. (debugDumpLayerTree)
S Dump accessibility tree in traversal order. (debugDumpSemantics)
U Dump accessibility tree in inverse hit test order. (debugDumpSemantics)
i Toggle widget inspector. (WidgetsApp.showWidgetInspectorOverride)
p Toggle the display of construction lines. (debugPaintSizeEnabled)
o Simulate different operating systems. (defaultTargetPlatform)
z Toggle elevation checker.
P Toggle performance overlay. (WidgetsApp.showPerformanceOverlay)
a Toggle timeline events for all widget build methods. (debugProfileWidgetBuilds)
An Observatory debugger and profiler on sdk gphone x86 is available at:
http://127.0.0.1:50607/ZMvxTxjmDD0=/
Run Code Online (Sandbox Code Playgroud)
好的,我能够解决这个问题。它似乎与最近的 Linux 内核版本 5.xx 有关,您可以在这里自行阅读:
https://github.com/flutter/flutter/issues/49185
如果您不想阅读:我卸载了该flutter
软件包并安装了该flutter-git
软件包。然后就成功了。
归档时间: |
|
查看次数: |
25866 次 |
最近记录: |