Не работает hot reload flutter android studio

Solved: Flutter Hot Reload or Restart Disabled and Not Working

Nowadays Flutter is getting more popular due to its simplicity and performance. Flutter uses Google’s Dart which is more different from Java and similar to JQuery in structurally.

Advantages of Flutter

  • Platform independent. Yes, you can build both android an iPhone application from a single code base.
  • Better performance
  • Simplicity
  • Hot Reload

Hot Reload

You don’t need to run your application each time for testing. The application is live while you creating it. This is the one of the best peculiarity of the flutter. If you edit something on your code, then you can see the change on your phone or virtual machines like AVD, Genymotion, etc without rebuild or rerun.

As a Flutter beginner, you may face many problem related on it. Problem with Hot Reload is one of them. Sometimes the Hot Reload may be disabled, deselected, inactive, not clickable or not proper workable.

Solutions:

Solution is always depends the problem. Many reasons may cause the issue.

Method #1: Re-install Flutter Plugin

  • This is the best solutions for your problem. First of all, uninstall the flutter.
  • File -> Settings -> Plugins (on MacOs: Preference -> Plugins)
  • Select Flutter. Uninstall (You might restart the IDE)
  • Now re-install the flutter.
  • File -> Settings -> Plugins (on MacOs: Preference -> Plugins)
  • Select ‘Browse repositories’.
  • Now search for ‘Flutter’. Select ‘Flutter’.
  • Install.

  • Restart the android studio (IDE).

Now the ‘Hot Reload’ button will be enabled.

Save All option is also used instead of Hot Reload button. (Ctrl + S or File Save All)

Method #2: The android project should be on running stage on android studio or your IDE

Method #3: Make sure your application is open and not closed by you after running.

The application should be active, phone is not locked and light is on. Hot Reload will not work if you close the application.

Читайте также:  Телефоны самсунг андроиды все модели

Method #4: Make sure the phone or virtual device is connected and listed as the running device.

Method #5: Make sure your Internet connection is active

Method #6: Restart Computer

Источник

Hot reload/hot restart not working #23442

Comments

bang88 commented Oct 24, 2018 •

Steps to Reproduce

  1. flutter create my_new_app
  2. flutter run

The text was updated successfully, but these errors were encountered:

zoechi commented Oct 24, 2018

What device did you run it with?
Is this with Android or iOS or both?

bang88 commented Oct 24, 2018

bang88 commented Oct 24, 2018

zoechi commented Oct 24, 2018

What about master or dev channel?

bang88 commented Oct 24, 2018

Both of them are not working

aam commented Oct 24, 2018 •

Can you see if you get same problem when launching on phyiscal ios device, Android simulator or phyiscal Android device?

In other words, is this is limited to ios simulator only?.

bang88 commented Oct 25, 2018

@aam No. both IOS and Android simulator have the same problem.

The phyiscal IOS device have the same problem

jeffreyyoung commented Nov 9, 2018

I too am seeing this

aam commented Nov 9, 2018

@jeffreyyoung can you do flutter run -v from command line, capture the output into a https://gist.github.com/ and link to the gist from here, please?

jeffreyyoung commented Nov 9, 2018 •

I was dumb, I was seeing it while unknowingly on the dev branch of flutter. changing to master and updating flutter fixed the issues I was seeing! I’m not sure if I can remember my specific environment when I was seeing the issue, but I definitely can’t reproduce on the latest version of master.

aam commented Nov 9, 2018

thank you for the follow up @jeffreyyoung .

yuyedaidao commented Nov 12, 2018

I have this issue, any branch can not work. I am dying

zoechi commented Nov 12, 2018

@yuyedaidao what Flutter channel?

@bang88 are you still seeing this on master branch?

bang88 commented Nov 13, 2018

@zoechi No. Its not work after switch to master branch.

Источник

Unable to hot reload in android studio (Button is disabled) #3578

Comments

eladkatz commented Jun 13, 2019

Thanks for the feedback! If your issue is related to the Flutter framework itself,
please open an issue at
github.com/flutter/flutter.

Steps to Reproduce

opened a new project, wrote some code, ran it once on an android emulator.

made a change, hit save all expecting to see the hot reload button turn on, but it did not.

Version info

Please paste the output of running flutter doctor -v here (available from the command
line or from Tools > Flutter > Flutter Doctor ). It will provide the version of the
Flutter framework as well as of the IntelliJ plugin.

L:\Dev\flutter\bin\flutter.bat doctor —verbose
[√] Flutter (Channel stable, v1.5.4-hotfix.2, on Microsoft Windows [Version 10.0.17134.765], locale en-US)
• Flutter version 1.5.4-hotfix.2 at L:\Dev\flutter
• Framework revision 7a4c33425d (6 weeks ago), 2019-04-29 11:05:24 -0700
• Engine revision 52c7a1e849
• Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)

Читайте также:  Диагностика субару для андроид

[√] Android toolchain — develop for Android devices (Android SDK version 29.0.0)
• Android SDK at L:/Dev/Android/SDK
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.0
• ANDROID_HOME = L:/Dev/Android/SDK
• ANDROID_SDK_ROOT = C:\Users\Elad.android
• Java binary at: L:\Dev\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.

[√] Android Studio (version 3.4)
• Android Studio at L:\Dev\Android Studio
• Flutter plugin version 36.1.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[√] Connected device (1 available)
• Android SDK built for x86 64 • emulator-5554 • android-x64 • Android 10 (API 29) (emulator)

• No issues found!
Process finished with exit code 0

The text was updated successfully, but these errors were encountered:

Источник

Flutter Горячая перезагрузка не работает в Android Studio (Mac)

Работая на компьютере Mac, я обнаружил, что горячая перезагрузка не работает в Android Studio. Я не знаю что не так 🙂

Вот код, который не перезагружается (я изменяю текст Hello world на текст Образец флаттера )

Это не остановит мое развитие, но я обеспокоен, почему это происходит.

8 ответов

Документация Android гласит: «Горячая перезагрузка загружает изменения кода в виртуальную машину и перестраивает дерево виджетов, сохраняя состояние приложения; оно не перезапускается main () или initState ( ) »

Таким образом, похоже, что если логика приложения находится за пределами основного метода , то горячая перезагрузка работает. Попробуйте выполнить рефакторинг своего приложения, как показано ниже, а затем выполните Перезагрузить (зеленая кнопка). Любые последующие изменения будут HOT RELOADED при сохранении.

Если я не ошибаюсь, горячая перезагрузка вызывает метод сборки вашего виджета, так как сделанные вами изменения не были внесены в метод сборки, это ничего не изменило на экране.

Попробуйте изменить текст внутри метода сборки виджетов и посмотрите, работает ли он.

Это работает, если ничего не помогает: 1. Закройте Android Studio и симуляторы.

Удалите Android Studio, открыв Finder, щелкните «Приложения», щелкните правой кнопкой мыши Android Studio и выберите «Переместить в корзину».

Удалить файлы Android: $ cd

/ Библиотека / Android $ rm -fr * $ cd $ rm -fr .android

Установите и запустите Android Studio и примите лицензионные соглашения https://developer.android.com/studio/install

Вы должны сохранить сделанные вами изменения в файле main.dart. После того, как горячая перезагрузка будет работать, на visual studio выберите опцию автосохранения, тогда она будет работать отлично.

* Горячая перезагрузка должна сначала сохранить ваши файлы.

Как использовать Flutter Hot Reload в StatelessWidget внутри Android Studio 3.6.2 и Flutter v1.12.13 + hotfix.9 в Linux . внутри файла main.dart:

Убедитесь, что в Android Studio> Файл> Настройки> Языки и рамки> Флаттер> отметьте «Выполнить горячую перезагрузку при сохранении» .

Используйте код ниже -> измените ‘Hello’ -> сохраните его -> посмотрите результат горячей перезагрузки

Оберните ваш код StatefulWidget , как показано в приведенном ниже коде. Это может сбивать с толку при просмотре старых учебников, потому что раньше они работали без него в более ранней версии Flutter.

Читайте также:  Nfs сервер для андроид

У меня такая же проблема. Для ее решения необходимо обновить флаттер SDK.

В терминале беги

flutter doctor -v

Кроме того, попробуйте File > Invalidate Caches / Restart. из меню студии Android

Источник

Hot reload doesn’t work in VS Code/Android Studio #57796

Comments

jaqpub commented May 22, 2020 •

I downloaded Visual Studio Code today and opened a new project — just the basic template that’s pre-installed. Using Ctrl-F5 I can get it to run on my Android device. However when I make a change (changing primarySwatch: Colors.red to primarySwatch: Colors.blue, for example, and then click Hot Reload, nothing changes. This happens whether I use the icon on the toolbar or type «r» into the terminal. I’ve tried on two different new projects, tried re-starting the software and even the computer, and tried a second phone. Same problem every time. It appears nothing is actually changing, as the log says, «Reloaded 0 of 495 libraries in 504ms.» There’s an error message related to Android SDK when I run flutter doctor (see below) but I don’t know what it means or how to fix it. I’m pretty new to programming. Any ideas?

The text was updated successfully, but these errors were encountered:

TahaTesser commented May 22, 2020

Hi @jaqpub
Please execute flutter doctor —android-licenses and accept licenses and try again in VS Code

Can you also try hot reload r press from flutter run and after saving changes and let me know if it works?

Thank you
Thank you

jaqpub commented May 22, 2020 •

This is the message after I run flutter doctor — android-linences:
Android sdkmanager tool not found (C:\Users\jeffj\AppData\Local\Android\sdk\tools\bin\sdkmanager).
Try re-installing or updating your Android SDK,
visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions.

hot reload using r after flutter run doesn’t work any better than using the icon.

Also, not sure if it helps but in Android Studio, hot reload is working just fine. Only in VSC doesn’t work.

VladyslavBondarenko commented May 22, 2020

@jaqpub
have you installed Android SDK Tools?
if no, does hot reload work after #51670 (comment)?

jaqpub commented May 24, 2020

Sorry for the delay, am traveling. Yes, I have installed SDK tools. Following the comment you linked to, I just now unchecked obsolete packages and installed the other package. Flutter doctor doesn’t show an SDK error now but hot reload still doesn’t work — shows no libraries being reloaded even though I’ve made a minor change (theme color).

Flutter doctor:
PS C:\Users\jeffj\Documents\VSC\flutter_complete_guide_visual_sc> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.17.1, on Microsoft Windows [Version 10.0.18362.836], locale en-SG)

[√] Android toolchain — develop for Android devices (Android SDK version 29.0.3)
[√] Android Studio (version 3.6)
[!] IntelliJ IDEA Community Edition (version 2019.3)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.45.1)
[√] Connected device (1 available)

Источник

Оцените статью