Skip to content

Hot Reload don't work in AndroidStudio 3.3.2 ( In Windows) #29121

Closed

Description

@JeeseC

My environment is wIndow + AndroidStudio 3.3.2, everything is ok, but Hot Reload don't work.
The small lightning icon is displayed normally ,it's also clickable.
And the console display :
"Initializing hot reload...
Syncing files to device Android SDK built for x86...
Reloaded 2 of 568 libraries in 1,181ms."
But there is no reload of the modified content on the emulator.
Please help me.

Activity

  1. smew-tech commented on Mar 10, 2019

    @smew-tech
  2. dnfield commented on Mar 10, 2019

    @dnfield
    Contributor

    @VNAPNIC please avoid comments like "me too" or "+1", which ends up notifying everyone subscribed to this issue.. Instead, upvote the original issue, which helps us better triage the issue and gauge how many people it's affecting.

  3. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    t: hot reloadReloading code during "flutter run"
    on Mar 10, 2019
  4. dnfield commented on Mar 10, 2019

    @dnfield
    Contributor

    @JeeseC can you share the output of flutter doctor -v?

  5. added this to the milestone on Mar 10, 2019
  6. JeeseC commented on Mar 11, 2019

    @JeeseC
    Author

    [√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 6.1.7601], locale zh-CN)
    • Flutter version 1.2.1 at F:\flutter
    • Framework revision 8661d8a (3 weeks ago), 2019-02-14 19:19:53 -0800
    • Engine revision 3757390
    • Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

  7. ened commented on Mar 11, 2019

    @ened
    Contributor

    @JeeseC how do you verify if hot reload worked? What did you try to change & what is the expected & actual output? Stating from the log message above, it seems to work well.

    Do note that stateful widgets may require a restart, not a reload, if you change underlying implementation. Alternatively, just navigate out and back into the specific area of your App.

  8. JeeseC commented on Mar 11, 2019

    @JeeseC
    Author

    @ened I just change some words of the textview, and then click the Hot reload button. But the simulator display nothing to change, so I think the hot reload don't work.
    The hot restart work well.

  9. dulinxi commented on Mar 11, 2019

    @dulinxi

    I have the same problem that when I change my code and save(Ctrl + S), it not reload. I must press the hot reload icon it will work.
    it output when I run flutter doctor -v

    [√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 10.0.17134.619], locale zh-CN)
        • Flutter version 1.2.1 at D:\flutter
        • Framework revision 8661d8aecd (3 weeks ago), 2019-02-14 19:19:53 -0800
        • Engine revision 3757390fa4
        • Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)
    
    [√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
        • Android SDK at D:\Android\Sdk
        • Android NDK location not configured (optional; useful for native profiling support)
        • Platform android-28, build-tools 28.0.3
        • ANDROID_HOME = D:\Android\Sdk
        • Java binary at: D:\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 D:\Program Files\Android\Android Studio
        • Flutter plugin version 33.3.1
        • Dart plugin version 182.5215
        • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    
    [√] Connected device (1 available)
        • STF AL10 • 5JPDU17712006976 • android-arm64 • Android 8.0.0 (API 26)
    
    • No issues found!
    
  10. DanTup commented on Mar 11, 2019

    @DanTup
    Contributor

    I can't repro on my PC and an Android 7.1 physical device. I created a new Flutter app using the wizard and made changes to the text and clicked save.

    Just trying to get an Android 8 emulator to work. Same in an Android 8.0 emulator, seemed to work fine.

    Can anyone reproduce it from the terminal with flutter run, or only in Android Studio?

  11. dnfield commented on Mar 11, 2019

    @dnfield
    Contributor

    /cc @jacob314 - this seems like a possible AS plugin issue

  12. dulinxi commented on Mar 12, 2019

    @dulinxi

    thanks for response ! when I save my code , nothing will show in the debug console . but I press the hot reload icon it show Reloaded 3 of 558 libraries in 1,163ms.. This problem happen in vscode and AndroidStudio, even though I create a new flutter project. I think it's not the problem of editor.

  13. jonahwilliams commented on Mar 12, 2019

    @jonahwilliams
    Contributor

    If you're noticing that hot restart is working and not hot reload, then it would be helpful if you shared the code you are trying to hot reload.

    If hot restart works, then does hot reload work following that hot restart?

  14. JeeseC commented on Mar 12, 2019

    @JeeseC
    Author

    @jonahwilliams Thanks for response! The code in link:
    After hot restart work well, hot reload still don't work.

  15. 5 remaining items

  16. DanTup commented on Mar 13, 2019

    @DanTup
    Contributor

    @JeeseC

    I hope Android Studio can be solved together.

    The VS Code v1.32 issue is a bug in VS Code and unrelated to hot reload not working in Android Studio (though I appreciate it seems coincidental for both to crop up within a few days). The VS Code issue will be fixed with a VS Code recovery release soon (see VS Code February 2019 Recovery 2 Endgame) and does not require a Flutter or VS Code extension fix.

    I don't think the cause of this issue in Android Studio is clear yet. Can you clarify whether you can repro this issue from the command line (using flutter run) and exactly what changes you're making that aren't applying when reloading, to make sure we can test the same thing?

    @devoncarew @jacob314 is there a way to get Android Studio to log the flutter run output?

  17. Ruzo commented on Mar 14, 2019

    @Ruzo

    Hey guys, I've had the same problem after installing flutter and Android Studio a couple of days ago. Since I just started a course and coding with Flutter for the first time, Hot Reload would not work in vscode or Android Studio when I changed and saved my main.dart file.

    However, as soon as I started using a new dart file that was imported into the main.dart one, Hot Reload started working.

    So, in my case, Hot Reload does not work in vscode or Android Studio when I save the main.dart file. It works with other files of the project.

  18. DanTup commented on Mar 14, 2019

    @DanTup
    Contributor

    @Ruzo What did your main.dart look like? Changes directly in the main() method won't work (see here), as main is not re-executed during a hot reload.

    If what you'er seeing isn't described by that, could you provide some sample code of what didn't work? Thanks!

  19. Ruzo commented on Mar 14, 2019

    @Ruzo

    @DanTup I guess that was the issue because the code was written inside the main() method until it was time to move it to a separate file. Kind of like:

    void main() {
      var App = MaterialApp(
         home: Scaffold( ...
    }
    
    

    Sorry. It was just a beginner's ignorance.

  20. DanTup commented on Mar 14, 2019

    @DanTup
    Contributor

    @Ruzo Thanks for confirming! I made this same mistake too :-)

    @JeeseC might this explain your original issue too? Can you give an example of the changes you were making?

  21. BufferUnderflower commented on Mar 19, 2019

    @BufferUnderflower

    There's definitely some issue with plugin, it just sometimes stops listening to IDE save event.
    At some point in time hitting save stops triggering the reload (which is still fully functional using icon).

    Re-plugging the phone as well as re-running the code doesn't help.
    Restarting AS makes it work again for some time.

    This usually happens after making changes for top-level functions/constants which i guess can't be hot-reloaded, but such situations shouldn't break the plugin's save on reload part at all.
    Also might happen after phone being unplugged.

  22. wk1017553772 commented on Mar 20, 2019

    @wk1017553772

    I can use Hot Reload in some root page, but not useful in deep route page in Android

    [√] Flutter (Channel master, v1.3.14-pre.7, on Microsoft Windows [Version 10.0.17134.648], locale zh-CN)
    • Flutter version 1.3.14-pre.7 at D:\flutter
    • Framework revision ee3e621 (28 hours ago), 2019-03-18 21:40:21 -0700
    • Engine revision 5088735
    • Dart version 2.2.1 (build 2.2.1-dev.1.1 None)

    [√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at C:\Users\wangk\AppData\Local\Android\Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = C:\Users\wangk\AppData\Local\Android\Sdk
    • Java binary at: D:\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

    [√] Android Studio (version 3.2)
    • Android Studio at D:\Android\Android Studio
    • Flutter plugin version 31.3.1
    • Dart plugin version 181.5656
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

  23. DanTup commented on Mar 20, 2019

    @DanTup
    Contributor

    I can use Hot Reload in some root page, but not useful in deep route page in Android

    Can you provide sample code showing the issue that we can try to reproduce with?

  24. wk1017553772 commented on Mar 22, 2019

    @wk1017553772

    I can use Hot Reload in some root page, but not useful in deep route page in Android

    Can you provide sample code showing the issue that we can try to reproduce with?

    In my project depend local Library each other,flutter-app is root project
    flutter-app pubspec.yaml:

    name: flutter_app
    description: A new Flutter application.
    dependencies:
       flutter:
         sdk: flutter
       flutter_localizations:
         sdk: flutter
         cupertino_icons: ^0.1.2
       # Local Library
       app_home_page:
         path: ../app-home-page
       app_login:
         path: ../app-login
    

    app_home_page pubspec.yaml:

    name: app_home_page
    description: A new flutter package project.
    version: 0.0.1
    author:
    homepage:
    
    dependencies:
      flutter:
        sdk: flutter
      # Local Library
      app_base:
        path: ../app-base
    
      app_theme_manager:
        path: ../app-theme-manager
    
      advertising_material:
        path: ../yezi_modules/advertising_material
    
      base_info:
        path: ../yezi_modules/base_info
    
       ......
    

    Hot Reload is useful and nomal in root project app_home_page and app-login .
    But no use for the subprocject app_base,advertising_material,base_info ,etc.
    In the subprocject change file ,it will show
    Reloaded 0 of 1291 libraries in xxxms.
    and nothing to change(AndroidStudio and Vs code all not work ).
    It become this after I upgrade Flutter version in Flutter version 1.3.14-pre.7

  25. sceyhuns commented on Nov 9, 2019

    @sceyhuns

    For flutter hot reload problems that may be happening with your project,
    It is a problem with your device, and not flutter or Android Studio
    This happens when your logcat hangs up.
    You might want to increase your buffer size.
    To do this, go into your device or emulator:
    Settings > Developer options (Ensure they are turned on),
    Change the buffer size to a higher number.
    Then run flutter run -v again

  26. jonahwilliams commented on Jan 9, 2020

    @jonahwilliams
    Contributor

    Without more information, we're not sure how to proceed with this issue. If you're still experience this, please file a new issue with all relevant fields included, along with flutter doctor and a complete snippet that reproduces the issue

  27. github-actions commented on Aug 17, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  28. locked as resolved and limited conversation to collaborators on Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    t: hot reloadReloading code during "flutter run"toolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions