0

I have an flutter app that I'm working on in Android Studio on a Windows 10 machine.Android Studio and the flutter SDK are the lastest stable versions.

I'm running an Pixel 2 phone as AVD to test the app but suddenly hot reload and hot restart won't update the app anymore.

For instance if I change the Icon of an Floating Action Button the icon normally changed after a hot reload or hot restart. Now changes are only visible after I a cold restart.

It seems like the hot restart/hot reload don't update the app on the virtual device.

I tried running the hot reload from the console, but that doesn't work either. I reseted the AVD, created a new one and even deleted and reinstalled Anroid Studio. No effect. The app doesn't change until a cold restart.

Is there any way to restore the previous behaviour?

Edit:

I have found the trigger of the problem but not yet the cause or a solution. It seems to be a refactoring problem. In an older version of the code, hot reload/restart works without problems. During development I moved a dart file to a new subdirectory. From /lib/app to /lib/app/home and let Android Studio adjust all references in the source code to this file. After that, the app can be compiled and started but hot reload/restart no longer works.
As a workaround, I have now copied the file instead of moving it and deleted the old file, but I would still like to know what exactly the problem is.

2
  • If you change the const variables it requires full restart because consts are initialized at compile time Commented Dec 9, 2020 at 23:37
  • It's not a const variable, it's the text of the title of the scaffold appbar or the icon of the scaffold floating action button Commented Dec 10, 2020 at 14:01

2 Answers 2

0

Have you tried running 'flutter clean' on your flutter project?

Sign up to request clarification or add additional context in comments.

4 Comments

Tried it, but still no effect. The app on the emulator only gets updated after cold restart, but no change with hot reload or hot restart.
Have you tried with another AVD like Pixel 3 or Pixel 3a?
Yes, I tried a Pixel 1 and a Nexus 6. Same problem. Is likely a refactoring problem, see my edit.
Try Build -> Rebuild Project
0

I assume you are not saving the changes made; try saving the changes (with cmd+s/crtl+s) then performing a hot restart or hot reload.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.