Flutter hot reload not working on tablet emulator - flutter

I am developing an app in Flutter with Android Studio 3.3.1.
I have just started the project, deleted a few boilerplate code about the default counter app and also created a tablet emulator.
I can run the code in the tablet without any problem pressing the play button, but when I make some changes in the code i do not get the hot reload button activated.
I have tried running the same app on another mobile emulator and the hot reload button actually works.
Anyone got the same problem?
The issue is happening with the emulator: Nexus 10 API Q

This problem is related to Android Studio 3.3.1 version.
I had a similar problem.
See Instant run shortcut does not work in Android Studio 3.3
and Instant Run missing in Android Studio 3.3
Update to the latest version which is 3.4 or downgrade to version 3.2

Related

Flutter project on android Studio 4.2.1 no database inspector, profiler and emulator window

Two months and no answer. Am I the only one having this problem?
Yesterday I downloaded and installed Android Studio Arctic Fox 2020.3.1 on my new laptop (Windows 10 64 bit, i7-8565U) and HAVE THE SAME PROBLEM AGAIN!!
Android projects I have all tools, Flutter project missing emulator window, database inspector and profiler!
Android Studio 4.2.1 on Windows 10. Latest stable Flutter version.
If I create an Android project I have all tools: database inspector, profiler and the emulator window.
If I create a Flutter project I have no database inspector, no profiler and no emulator window.
Flutter doctor gives no error.
Everything worked fine until the upgrade to 4.2.1
What's going on? Thank you
I've had this issue and been following this question from the time you posted it. Finally found a solution to it on another SO question.
Solution: Enable the Android Facet It turned out that I had to enable
the Android Facet for this project:
Go to File → Project Structure Choose Facets Press the small + Button
at the top Select Android from the list Confirm your project by
clicking the project_name and press OK
Please check out the full answer here:
https://stackoverflow.com/a/68839489/8362593
I hope it works for you too.
If it's not showing then you can do one thing go to
Help > Find action or ctrl+shift+A > Then search.
Try Windows -> Restore default (Shift+F12 by default)
And also you can specify which windows to show: In bookMark View
I think you might rather have the PATH wrong (which means: using an outdated emulator),
because the emulator now resides in directory called emulator (which wasn't always the case).
This can be easily verified:
emulator -v
emulator: Android emulator version 30.8.4.0 (build_id 7600983) (CL:N/A)
If you'd get anything less than the current version 30.8.4.0 (despite having installed version 30.8.4.0 with the SDK Manager), you'd know what the actual cause is. Once having fixed the PATH, the proper version of the emulator should become accessible / usable ...and even an upgrade to Arctic Fox should then be possible, at least while the Flutter build.gradle scripts are compatible with Gradle 7.1.1.
Your workaround in words, you probably found this out, and did not bother to document it.
It is just for the next person :-).
Start your flutter app in debug mode.
Select your android folder in flutter project.
Right click -> Flutter -> Open in Android Studio.
Do NO upgrade Gradle Plugin, when suggested.
It might break flutter build and is not needed.
Android Window:
Click Debug Icon.
Wait a bit.
Click something in your app, so your db is active.
Android Window:
Click App Inspection at bottom of android window.
Result:
The Database Inspector shows up, and you can inspect db content in android window.
-- You have to switch between windows, and yes, it is a pain in the but.
-- Flutter plugin and Android integration is lackluster since 2018, but probably very hard to keep up with all that upstream in sync :-(.
Right, basically it doesn't work. That's it. Maybe one day it will. In the meantime I'm using AS 4.1.3 so that I can get all the available tools.
Remember to set environment: sdk: ">=2.12.0 <3.0.0" to have null-safety enabled and to go to Project Structure and set an SDK otherwise you'll get the old ADB.exe file not found when starting the Emulator which means also no Profiler and a bunch of other tools.

Flutter: Hot Reload gets stuck in Visual Studio Code

UPDATE:
I tried with another clean new project. Hot reload works fine.
Every time I perform a hot reload on my VS Code, the hot reload gets stuck with the following message. Anyone knows the problem?
These are the things that I have done.
Terminal: Ran flutter doctor -- (everything ok, except a warning sign of a little bit outdated Xcode. I'm using Xcode 11.1.0)
Restarted VS
Restarted the entire machine
Running on both simulator and physical iPad
These are my specs:
Macbook Pro Early 2015
macOS Mojave
VS Code 1.52.1 (latest)
Flutter extension v3.18.1 (latest)
Dart v3.18.1 (latest)
Xcode 11.1.0 (not latest)
Debug console:
Launching lib/main.dart on iPad Pro (9.7-inch) in debug mode...
lib/main.dart:1
Xcode build done. 82.4s
Connecting to VM Service at ws://127.0.0.1:51095/_Dfl55VaXyE=/ws
if you are using Listview.builder or Grideview.builder then
comment it out or remove that code block.
sometimes it happens because of the unbounded height problem of
listview.builder and hot reload get stuck and fail to compile the
code.
I was try open DevTools in the browser and press Hot reload button and it's working!
Not sure which Flutter version you were using but you could be running into a case of https://github.com/flutter/flutter/issues/84347 which is related to isolates getting somehow stuck during hot reload.
I don't know the audioplayers library but I assume it uses an isolate in the background.
Delete the emulator and run flutter clean from the terminal.
Then create the emulator again and it will fix the issue.
Run flutter clean and run your project again and see if that solves the problem.

How to hot reload on both ios and android devices at the same time using IntelliJ IDEA?

I'm using IntelliJ IDEA to code Flutter and usually have 2 simulators running (ios and android). It is kinda annoying when I have to switch the target device manually when I update the code.
Any plugin that can do the trick for IntelliJ IDEA
~As I know, this feature only supported in Visual Studio Code~
Please check https://github.com/flutter/flutter/wiki/Multi-device-debugging-in-VS-Code
Updated Genchi Genbutsu
It possible to do with console commands
Flutter Hot Reload to multiple devices

Running Flutter on a Genymotion machine using VS Code

I'm using VS Code as my IDE for Flutter and I'm trying to run my app in a Genymotion machine. How can I do that? The machine doesn't appear in VS Code bottom bar in the Devices section.
N.B:
I'm not looking for any solutions regarding Android emulators or Android Studio, only VS Code with Genymotion.
Alright, so after an hour or so of searching I found out the solution. It's entirely the same as the approach of using Genymotion in Android Studio. The only difference is you don't need to install a plugin for VS Code. However, in my case, it was a bug in Genymotion it self. I was using v3.0.1 which had some incompatibility bug with Android SDK 28 and this was the reason why the Genymotion machine did not show up as a device in VS Code, because this latter relies on Android SDK to determine what are the devices that run Android.
The solution for me was simply upgrading my Genymotion to v3.0.2 which fixed the incompatibility with Android SDK 28.
In case anyone runs into this problem in the future and this doesn't work, make sure that your Genymotion ADB settings use the Android SDK installed in your machine by Android Studio and not the one shipped with Genymotion itself.

Flutter- Creating an android emulator for my app

I wrote an app, and now I want to test on a Android environment,but when I press debug, no emulator is shown. I clicked on create new emulator, and It says creating new emulator, but nothing happens after that. Also, I tried to connect my phone to use it as an emulator but It wasn't being found by visual studio code. I am a beginner so please, any helps
Try to reinstall flutter SDK and don't forget to install flutter plugin on your editor (Android Studio or VsCode), Depending on your OS follow one of this instruction, it's so simple to install.
https://flutter.io/docs/get-started/install