Я хочу разрабатывать android приложения с флаттером без использования Android Studio или какой-либо другой IDE. В настоящее время я устанавливаю все в свой дистрибутив linux на основе arch. У меня все отлично работает, кроме функции горячей перезагрузки. Когда я делаю flutter run
(или даже flutter run --hot
), выполнение команды застревает в следующей точке:
$ flutter run --hot ✔ 926 10:53:42
Using hardware rendering with device AOSP on IA Emulator. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib/main.dart on AOSP on IA Emulator in debug mode...
Running Gradle task 'assembleDebug'... 16.0s
✓ Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk... 2.1s
D/FlutterActivity( 5356): Using the launch theme as normal theme.
D/FlutterActivityAndFragmentDelegate( 5356): Setting up FlutterEngine.
D/FlutterActivityAndFragmentDelegate( 5356): No preferred FlutterEngine was provided. Creating a new FlutterEngine for this FlutterFragment.
D/FlutterActivityAndFragmentDelegate( 5356): Attaching FlutterEngine to the Activity that owns this Fragment.
D/FlutterView( 5356): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@a4c3a46
D/FlutterActivityAndFragmentDelegate( 5356): Executing Dart entrypoint: main, and sending initial route: /
Syncing files to device AOSP on IA Emulator...
I/Choreographer( 5356): Skipped 39 frames! The application may be doing too much work on its main thread.
D/EGL_emulation( 5356): eglMakeCurrent: 0xee21eda0: ver 2 0 (tinfo 0xebee8750)
I/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,
D/EGL_emulation( 5356): eglMakeCurrent: 0xec205360: ver 2 0 (tinfo 0xec2033b0)
D/eglCodecCommon( 5356): setVertexArrayObject: set vao to 0 (0) 1 0
Под застрявшим я имею в виду, что программа просто выводит сообщения журнала и игнорирует все мой вклад. Я уже пробовал такие вещи, как нажатие r
или R
, но это просто приводит к
D/eglCodecCommon( 5356): setVertexArrayObject: set vao to 0 (0) 1 0
rR
и не реагирует на эмулируемое устройство.
Вот некоторые результаты, если вам интересно:
flutter doctor
приводит к:
[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Linux, locale en_US.UTF-8)
• Flutter version 1.12.13+hotfix.8 at /opt/flutter
• Framework revision 0b8abb4724 (4 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /opt/android-sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /opt/android-sdk
• Java binary at: /usr/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-b08)
• All Android licenses accepted.
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/setup/#android-setup for detailed instructions).
[✓] Connected device (1 available)
• AOSP on IA Emulator • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
Так как это было запрошено, вот последняя часть вывода flutter run -v
:
[ +23 ms] Android Debug Bridge version 1.0.41
Version 29.0.6-6198805
Installed as /opt/android-sdk/platform-tools/adb
[ +1 ms] executing: /opt/android-sdk/platform-tools/adb start-server
[ +19 ms] Installing build/app/outputs/apk/app.apk...
[ ] executing: /opt/android-sdk/platform-tools/adb -s emulator-5554 install -t -r /home/fox/tmp/testy/build/app/outputs/apk/app.apk
[+2544 ms] Performing Streamed Install
Success
[ ] Installing build/app/outputs/apk/app.apk... (completed in 2.5s)
[ +4 ms] executing: /opt/android-sdk/platform-tools/adb -s emulator-5554 shell echo -n d26fd49fc8a8132a5b3be06672c852791523c0be > /data/local/tmp/sky.com.example.testy.sha1
[ +92 ms] AOSP on IA Emulator startApp
[ +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
true --ez enable-checked-mode true --ez verify-entry-points true com.example.testy/com.example.testy.MainActivity
[ +379 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000 cmp=com.example.testy/.MainActivity (has extras) }
[ +1 ms] Waiting for observatory port to be available...
[+1187 ms] D/FlutterActivity( 5901): Using the launch theme as normal theme.
[ +5 ms] D/FlutterActivityAndFragmentDelegate( 5901): Setting up FlutterEngine.
[ ] D/FlutterActivityAndFragmentDelegate( 5901): No preferred FlutterEngine was provided. Creating a new FlutterEngine for this FlutterFragment.
[+1996 ms] D/FlutterActivityAndFragmentDelegate( 5901): Attaching FlutterEngine to the Activity that owns this Fragment.
[ +95 ms] D/FlutterView( 5901): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@a4c3a46
[ +54 ms] D/FlutterActivityAndFragmentDelegate( 5901): Executing Dart entrypoint: main, and sending initial route: /
[ +140 ms] Observatory URL on device: http://127.0.0.1:34706/KylafuV8tWY=/
[ +3 ms] executing: /opt/android-sdk/platform-tools/adb -s emulator-5554 forward tcp:0 tcp:34706
[ +14 ms] 44911
[ ] Forwarded host port 44911 to device port 34706 for Observatory
[ +12 ms] Connecting to service protocol: http://127.0.0.1:44911/KylafuV8tWY=/
[ +698 ms] Successfully connected to service protocol: http://127.0.0.1:44911/KylafuV8tWY=/
[ +5 ms] Sending to VM service: getVM({})
[ +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
"android_ia32", _profilerMode: VM, _nativeZoneMemoryUsage: 0, pid: 5901, st...
[ +14 ms] Sending to VM service: getIsolate({isolateId: isolates/2827659313742019})
[ +11 ms] Sending to VM service: _flutter.listViews({})
[ +76 ms] Result: {type: Isolate, id: isolates/2827659313742019, name: main, number: 2827659313742019, _originNumber: 2827659313742019, startTime: 1584009467451, _heaps: {new: {type: HeapSpace,
name: new, vmName: Scavenger, collections: 2, avgCollectionPeriodMillis...
[ +30 ms] Result: {type: FlutterViewList, views: [{type: FlutterView, id: _flutterView/0xebf68710, isolate: {type: @Isolate, fixedId: true, id: isolates/2827659313742019, name:
main.dart$main-2827659313742019, number: 2827659313742019}}]}
[ +25 ms] DevFS: Creating new filesystem on the device (null)
[ +2 ms] Sending to VM service: _createDevFS({fsName: testy})
[ +58 ms] Result: {type: FileSystem, name: testy, uri: file:///data/user/0/com.example.testy/code_cache/testyTKZBNK/testy/}
[ ] DevFS: Created new filesystem on the device (file:///data/user/0/com.example.testy/code_cache/testyTKZBNK/testy/)
[ +2 ms] Updating assets
[ +137 ms] Syncing files to device AOSP on IA Emulator...
[ +3 ms] Scanning asset files
[ +3 ms] <- reset
[ ] Compiling dart to kernel with 0 updated files
[ +12 ms] /opt/flutter/bin/cache/dart-sdk/bin/dart /opt/flutter/bin/cache/artifacts/engine/linux-x64/frontend_server.dart.snapshot --sdk-root
/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
/home/fox/tmp/testy/.packages -Ddart.vm.profile=false -Ddart.vm.product=false
--bytecode-options=source-positions,local-var-info,debugger-stops,instance-field-initializers,keep-unreachable-code,avoid-closure-call-instructions --enable-asserts --track-widget-creation
--filesystem-scheme org-dartlang-root
[ +20 ms] <- compile package:testy/main.dart
[ +69 ms] D/EGL_emulation( 5901): eglMakeCurrent: 0xee21f400: ver 2 0 (tinfo 0xee22aaf0)
[ +5 ms] D/eglCodecCommon( 5901): setVertexArrayObject: set vao to 0 (0) 1 0
Вывод flutter devices -v
is
$ flutter devices -v ✔ 936 14:29:36
[ +14 ms] executing: [/opt/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +40 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ ] 0b8abb4724aa590dd0f429683339b1e045a1594d
[ ] executing: [/opt/flutter/] git describe --match v*.*.* --first-parent --long --tags
[ +9 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[ ] v1.12.13+hotfix.8-0-g0b8abb472
[ +8 ms] executing: [/opt/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +8 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/stable
[ ] executing: [/opt/flutter/] git ls-remote --get-url origin
[ +7 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ +68 ms] executing: [/opt/flutter/] git rev-parse --abbrev-ref HEAD
[ +11 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] stable
[ +41 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +5 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +83 ms] executing: /opt/android-sdk/platform-tools/adb devices -l
[ +18 ms] Exit code 0 from: /opt/android-sdk/platform-tools/adb devices -l
[ ] List of devices attached
emulator-5554 device product:sdk_gphone_x86_arm model:AOSP_on_IA_Emulator device:generic_x86_arm transport_id:4
[ +36 ms] 1 connected device:
[ +14 ms] /opt/android-sdk/platform-tools/adb -s emulator-5554 shell getprop
[ +87 ms] ro.hardware = ranchu
[ +6 ms] AOSP on IA Emulator • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
[ +15 ms] "flutter devices" took 320ms.