简体   繁体   English

Flutter 热重装不工作。 需要帮助

[英]Flutter hot reload is not working. help needed

Flutter hot reload is not working with intelliJ/ Android studio. Flutter 热重装不适用于 intelliJ/Android 工作室。

纽扣

Once I run the app on my Poco F1 which run Android Q and is rooted, the app runs on the device but I cannot rerun the app or hot reload it, I have to stop and build again.一旦我在运行 Android Q 并已植根的 Poco F1 上运行该应用程序,该应用程序将在设备上运行,但我无法重新运行该应用程序或热重新加载它,我必须停止并重新构建。

I am able to get the logs from the app, so there is no problem of connectivity.我能够从应用程序中获取日志,因此没有连接问题。

Things I've tried:我尝试过的事情:

  1. Flutter clean Flutter 清洁
  2. Increased Logger Buffer Size增加记录器缓冲区大小
  3. Tried Emulator with Android Q尝试使用 Android Q 的仿真器
  4. Tried Emulator with Android P尝试使用 Android P 的仿真器
  5. Tried device with Android P用 Android P 试用的设备
  6. Changing channels改变频道

Following is my flutter doctor -v:以下是我的 flutter 医生 -v:

[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.18362.836], locale en-IN)
    • Flutter version 1.12.13+hotfix.9 at C:\tools\flutter
    • Framework revision f139b11009 (8 weeks ago), 2020-03-30 13:57:30 -0700
    • Engine revision af51afceb8
    • Dart version 2.7.2


[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at C:\Users\Ghost\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[√] Android Studio (version 3.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 34.0.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[√] IntelliJ IDEA Community Edition (version 2019.3)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.3.2
    • Flutter plugin version 45.1.2
    • Dart plugin version 193.6015.53

[√] Connected device (1 available)
    • POCO F1 • 50c8824d • android-arm64 • Android 10 (API 29)

• No issues found!

If I do Flutter run:如果我执行 Flutter 运行:

Launching lib\main.dart on POCO F1 in debug mode...
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                         6.5s
√ Built build\app\outputs\apk\debug\app-debug.apk.
D/FlutterActivity(29390): Using the launch theme as normal theme.
D/FlutterActivityAndFragmentDelegate(29390): Setting up FlutterEngine.
D/FlutterActivityAndFragmentDelegate(29390): No preferred FlutterEngine was provided. Creating a new FlutterEngine for this FlutterFragment.
D/FlutterActivityAndFragmentDelegate(29390): Attaching FlutterEngine to the Activity that owns this Fragment.
D/FlutterView(29390): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@cdd7e8a
D/FlutterActivityAndFragmentDelegate(29390): Executing Dart entrypoint: main, and sending initial route: /

Dependencies:依赖项:

dependencies:
  flutter:
    sdk: flutter
  http: ^0.12.0+4
  shared_preferences:
  google_fonts:

So even if I close the app on device, main.dart doesn't stop.因此,即使我关闭设备上的应用程序,main.dart 也不会停止。

Any Idea what's causing this issue and how to solve it?任何想法是什么导致了这个问题以及如何解决它?

I also had the same issue before.我之前也有同样的问题。 I faced the issue with the older flutter versions.我遇到了较旧的 flutter 版本的问题。 Run following commands运行以下命令

flutter clean
flutter upgrade

Now try to run the app and check the hot reload.现在尝试运行应用程序并检查热重载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM