Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter hot reload not working on my device

On my device, flutter does not hot reload, I initially thought this was a problem with flutter or android studio or vs code but when I use a different device, the hot reload is working. How do I resolve this, it's just been driving me crazy and I have already spent a lot of hours trying to figure this out.

And btw, it was initially working on this device until it wasn't, and I have already restarted my phone, I have even reinstalled flutter, basically every suggestion from the internet I have tried but so far, no fruits.

Any help would be highly appreciated, here is the flutter doctor -v.

[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Linux, locale en_US.UTF-8)
• Flutter version 1.12.13+hotfix.9 at /home/hamisi/flutter
• Framework revision f139b11009 (5 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.2)
    • Android SDK at /home/hamisi/android
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = /home/hamisi/android/
    • Java binary at: /home/hamisi/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Android Studio (version 3.5)
    • Android Studio at /home/hamisi/android-studio
    • Flutter plugin version 44.0.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] Connected device (1 available)
    • LG H845 • LGH845e35cd375 • android-arm • Android 7.0 (API 24)

• No issues found!

The output from flutter run -v --trace-startup is https://pastebin.com/9X4S5LWr

like image 492
lulliezy Avatar asked May 05 '20 07:05

lulliezy


People also ask

How do I activate hot reload?

Enable Hot Reload when starting without debugging. Enables Hot Reload when starting without the debugger attached (Ctrl+F5).

Does flutter have hot reload?

Perform Hot Reload: Run your flutter editor from the app or using the command prompt. We can use hot reload in flutter debug mode. Once your flutter project has been created do some changes in your code and perform a hot reload. In windows, you can perform a hot reload using 'ctrl+\' or using the hot reload button.


2 Answers

I had this exact problem with a Pixel 2. Fine one minute, then boom - hot reload / restart was not available. I could deploy the app to the device, but hot reload options were greyed out in Android Studio and hot reload keyboard shortcuts did nothing. Pressing r after flutter run also did nothing. Nothing significant happened in between it working and it not working - no updates to Android Studio, Flutter or the device. I tried restarting the device, Android Studio, flutter clean, I tried swapping the USB cable, nothing seemed to work.

It did eventually start working again: I did a flutter clean followed immediately by a reboot of my computer. I have no idea if this was the fix, or whether it was just one of those random who-the-f-knows, but hopefully it will help anyone else.

[√] Flutter (Channel stable, v1.17.0, on Microsoft Windows [Version 10.0.18362.778], locale en-GB)
    • Flutter version 1.17.0 at D:\flutter
    • Framework revision e6b34c2b5c (10 days ago), 2020-05-02 11:39:18 -0700
    • Engine revision 540786dd51
    • Dart version 2.8.1


[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at C:\Users\james\AppData\Local\Android\sdk
    • 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_212-release-1586-b04)
    • All Android licenses accepted.

[√] Android Studio (version 3.6)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] Connected device (1 available)
    • Pixel 2 • HT7C11A06689 • android-arm64 • Android 10 (API 29)

• No issues found!

like image 195
James Allen Avatar answered Oct 17 '22 12:10

James Allen


I had this issue some days ago I did a couple of things:

  1. In some files may be added file:/// before the file name in the above file. Search in the whole project and remove file:/// line and again import that package again.

  2. flutter upgrade

  3. Clean project(flutter clean)

  4. I also change my emulator.

that worked for me

like image 24
mohsen tavosi Avatar answered Oct 17 '22 12:10

mohsen tavosi