Frank Ropen
Frank Ropen

Reputation: 99

Flutter App in Android Studio doesn't get updated on virtual device by hot reload or hot restart

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.

Upvotes: 0

Views: 1118

Answers (2)

Bhuvan Ade
Bhuvan Ade

Reputation: 31

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.

Upvotes: 0

Kevin Koo
Kevin Koo

Reputation: 171

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

Upvotes: 0

Related Questions