简体   繁体   中英

Flutter hot reload is not working. help needed

Flutter hot reload is not working with intelliJ/ Android studio.

纽扣

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.

I am able to get the logs from the app, so there is no problem of connectivity.

Things I've tried:

  1. Flutter clean
  2. Increased Logger Buffer Size
  3. Tried Emulator with Android Q
  4. Tried Emulator with Android P
  5. Tried device with Android P
  6. Changing channels

Following is my flutter doctor -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:

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.

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. Run following commands

flutter clean
flutter upgrade

Now try to run the app and check the hot reload.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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