2

颤振构建/同步过程对我来说没有完成。它卡在Syncing files to device Android SDK built for x86....

这个问题发生在每个应用程序上,并且没有连接到模拟器本身,因为即使是物理设备(Nexus 5X)也有同样的问题。为了方便起见,模拟器是用flutter emulators --create --name nexus

我的主要问题是无法使用热重载、调试工具和其他功能。我该如何进一步调查/调试?


仅限控制台

  • 编译和执行工作正常
  • 应用程序是响应式的,控制台打印语句工作,带有控制台输出。

颤振医生-v

[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Linux, locale en_US.UTF-8)
    • Flutter version 1.12.13+hotfix.8 at /home/jannik/devenv/flutter
    • Framework revision 0b8abb4724 (6 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 /home/jannik/devenv/android-sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = /home/jannik/devenv/android-sdk
    • ANDROID_SDK_ROOT = /home/jannik/devenv/android-sdk
    • Java binary at: /usr/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_232-solus-ga)
    • 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)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)

! Doctor found issues in 1 category.

扑跑

Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider
enabling software rendering with "--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                        11.8s
✓ Built build/app/outputs/apk/debug/app-debug.apk.
D/FlutterView( 4752): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@82cc314
Installing build/app/outputs/apk/app.apk...                         1.7s
D/FlutterActivity( 5134): Using the launch theme as normal theme.
D/FlutterActivityAndFragmentDelegate( 5134): Setting up FlutterEngine.
D/FlutterActivityAndFragmentDelegate( 5134): No preferred FlutterEngine was provided. Creating a new FlutterEngine for this FlutterFragment.
D/FlutterActivityAndFragmentDelegate( 5134): Attaching FlutterEngine to the Activity that owns this Fragment.
D/FlutterView( 5134): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@eb0c503
D/FlutterActivityAndFragmentDelegate( 5134): Executing Dart entrypoint: main, and sending initial route: /
D/FlutterView( 4752): Detaching from a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@82cc314
D/EGL_emulation( 5134): eglMakeCurrent: 0xa6196880: ver 2 0 (tinfo 0xa48618e0)
Syncing files to device Android SDK built for x86...
I/flutter ( 5134): pressed                                      
Syncing files to device Android SDK built for x86...
I/flutter ( 5134): pressed                                      
Syncing files to device Android SDK built for x86...
I/flutter ( 5134): pressed                                      
Syncing files to device Android SDK built for x86...
(This is taking an unexpectedly long time.)       ⣻

颤动运行 -v

https://gist.github.com/jnnksdev/78c1d2d1b6d86a06d387786c07667918


视觉工作室代码

  • 编译看起来不错
  • 应用程序没有响应且不显示(白色画布,仅此而已)

运行 > 开始调试

Launching lib/main.dart on Android SDK built for x86 in debug mode...
✓ Built build/app/outputs/apk/debug/app-debug.apk.
D/FlutterView( 4752): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@82cc314
D/FlutterActivity( 6179): Using the launch theme as normal theme.
D/FlutterActivityAndFragmentDelegate( 6179): Setting up FlutterEngine.
D/FlutterActivityAndFragmentDelegate( 6179): No preferred FlutterEngine was provided. Creating a new FlutterEngine for this FlutterFragment.
D/FlutterActivityAndFragmentDelegate( 6179): Attaching FlutterEngine to the Activity that owns this Fragment.
D/FlutterView( 6179): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@82cc314
D/FlutterActivityAndFragmentDelegate( 6179): Executing Dart entrypoint: main, and sending initial route: /
D/FlutterView( 4752): Detaching from a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@82cc314

Flutter:运行 Flutter Doctor

[flutter] flutter doctor -v
[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Linux, locale en_US.UTF-8)
    • Flutter version 1.12.13+hotfix.8 at /home/jannik/devenv/flutter
    • Framework revision 0b8abb4724 (6 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 /home/jannik/devenv/android-sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = /home/jannik/devenv/android-sdk
    • ANDROID_SDK_ROOT = /home/jannik/devenv/android-sdk
    • Java binary at: /usr/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_232-solus-ga)
    • 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)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)

unname -a

Linux sol 5.5.7-150.current #1 SMP PREEMPT Wed Mar 4 03:31:00 UTC 2020 x86_64 GNU/Linux
4

4 回答 4

3

我不知道为什么同步过程没有完成,但解决方案是切换到“更新”的颤振通道,flutter channel beta例如。

您可以使用 列出可用频道flutter channelflutter upgrade换频道后别忘了。

于 2020-03-29T13:34:05.250 回答
3

将其放在runApp()main 函数中的语句之前

WidgetsFlutterBinding.ensureInitialized();

这为我修好了。

于 2020-08-19T17:41:55.843 回答
1

我刚刚发现使用 firebaseMessaging 插件会导致此错误。如果您使用的是 onBackgroundMessage 方法,请尝试评论它。

我已经评论了这一行,并且“将文件同步到设备”不会永远卡住......

于 2021-02-07T11:35:15.377 回答
0

在我的情况下,这是我使用 GetX 的代码中的一个错误,这意味着构建树没有响应(例如下拉菜单的无限循环问题)并因此停止同步。如果我在 GetX 部分之前放置一个断点,它将刷新/同步

于 2022-01-20T19:59:51.983 回答