How to set up flutter android emulator in VS code - dart

In the latest flutter 0.5.1 release version they say you can launch an emulator in browser. Does anyone know how to get this up and working??

There's no way to launch an emulator in the browser; I think there is a screenshot that's badly-placed in that article that might have confused things. The screenshot is unrelated to launching emulators.
However, launch real emulators (not in the browser) is indeed supported in VS Code. As long as you have >= v0.5.1 of Flutter and v2.13 of the Dart plugin for VS Code, you can indeed launch emulators from the editor.
Taken from the release notes:
Emulator Launching
Emulators can now be launched directly from within Code. If you start debugging without a connected device you'll be presented with a list of emulators on your system to launch.
After selecting a device a notification will appear while the device boots and connects.
You can also trigger the emulator selection by clicking on No devices in the status bar or by running the Flutter: Launch Emulator command from the command palette.

Related

iOS 14 not letting Flutter apps (still in dev) to launch from the home screen compared to Building/Running from the IDE

I've been developing a news app with Flutter and when I build and run it through Android Studio it launches fine, but when I try to launch the app by clicking on it on the home screen, it says "in iOS 14+, debug mode flutter apps can only be launched from Flutter tooling,IDEs ....."(Screenshot attatched). Can someone tell me as to how to get around this?
Apparently, this is a known issue of Flutter on iOS 14 for apps in debug mode, see this article on the Flutter website, and this GitHub issue. So for the time being, I believe your main workarounds are the following:
Always run the app from the host PC (using flutter run, IDE debug, etc.)
Build a release version of your app (instead of debug) and use that on your device, e.g. use flutter run --release
Use a device with iOS 13 or older
Use a simulator
If you want to use the app without being connected via usb
Open the ios folder on Xcode
Make sure your device is connected
Select Product from the menu bar -> Scheme -> Edit Scheme
Or simply use the shortcut: command + >
Step 3
Change the build configure to Release
Run the app from Xcode
Disconnect your device and you're good to go!

In Ios 14 Flutter App does not save in Debug mode

recently I updated my iPhone version to IOS 14, but after updating to a newer software version my flutter app not save in debug mode.
(As a simple word, I am run my flutter application on my ios device with a USB cable,
but after removing the USB cable, my application automatically closes and not open again without connection in debug mode.
this issue only arises in IOS 14.
It works fine only if the connection is established in the device with Xcode.)
this issue not arise in other IOS versions like IOS 13.
This GitHub issue suggests upgrading flutter (use flutter upgrade) or using flutter run --release.
It is a new limitation in iOS 14.
"due to changes in debugger mechanisms, once a Flutter debug application is installed on the device (either by using flutter run a Flutter-enabled IDE, or from Xcode), the application can no longer be re-launched by tapping the application’s icon in the home screen in iOS 14 on physical devices."
https://flutter.dev/docs/development/ios-14
If you want to see more details about the issue: https://github.com/flutter/flutter/issues/60657

How to choose iPhone simulator model to debug Flutter app on Visual Studio Code?

How to choose iPhone model to debug a Flutter application using VSCode? Currently every time I debug an app, iPhoneX always starts, but I would like to choose another model, for example iPhone 8, how do I do this?
What I did was change the selected iOS device in the simulator, closing the simulator, then restarted my debugging session. The flutter app was then loaded on to the newly selected device.
I am using a Macbook Pro. So if you [right-click or two-button-click] the Simulator app -> select 'Device' -> select the iOS you want -> then select the desired device
The Dart VS Code extention documentation here mentions a few ways to change the device that's used.
Clicking on the currently selected device in the status bar
Executing the Flutter: Select Device command
Pressing your custom key binding for the Flutter: Select Device command
// 2022
Easy way to do this is start the simulator and from MacOS dock, right click on the simlator - > Device -> ios -> choose new simlator
Unfortunately it's not currently possible to change which iOS device is launched in the simulator from VS Code (or the flutter emulator command, which uses the same code).
It seems like a neat idea though - I'd encourage raising an issue in the flutter/flutter repo (VS Code delegates listing and launching emulators to the Flutter tool - this allows more code to be shared across editors). Please include some info on your use cases (for example why you usually want iPhone 8 instead of X) to ensure they're considered (for example one way to avoid having a huge list of devices would be to include one iPhone, one iPad, etc. - but this might not cover your requirements).
Also - FWIW, for me the similator always loads the device that was last used.. I selected iPhone 8 and quit, then next time I launched it (from VS Code) it was still iPhone 8. Do you not see this behaviour?
Extension to Danny's Answer:
Just start an iOS Simulator from XCode and then you'll be able to see that specific simulator's name in the list of options (when you'll try to choose the target device).
What worked for me was running flutter doctor in the terminal. it gave me the following output:
[!] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
Xcode was installed previously, but after running the two commands, I was finally able to use the iOS Simulator in visual studio code.

what's the principle of xamarin.ios remote simulator?

xamarin.ios has a powerfull feature: mirror the ios simulator to windows.
I'd like to know how xamarin implements it.
when the mirrored simulator is showing in WIN, I can't find any Simulator.app process running in the MAC, so how does xamarin run it ? is there any public API for controlling the ios simulator ?
when the mirrored simulator is showing in WIN, I can't find any
Simulator.app process running in the MAC, so how does xamarin run it ?
The simulator is still running in the mac. The process is com.apple.CoreSimlutor.CoreSimlutorService, I find some related processes about simulator when run the simulator on Windows.
And I think the mirrored simulator is showing in WIN is using the technology like a remote desktop. Like VNC. (Just my own thinking, not the official answer)
Here is the picture:

Converting a Xamarin.forms iOS app into Xcode app

I am having a problem but can't seem to find the much-needed information online, having trawled through the internet. I have Xamarin.forms iOS app that I want to test. I cannot run iOS in windows so transferred to mac.
To inspect elements in the app, I need to open the app in Xcode or appium inspector, so I created an Xcode project from the source control containing the Xamarin.forms iOS app. I ran the project and the build was successful.
I deployed the compiled app to an iOS simulator and it deployed okay. This is where the problem is - The deployed app open in the simulator as a blank app showing a white screen with only the battery indicator and a clock showing at the top of the blank white screen. The app is not visible.
From research, I read that this blankness is due to the fact that I was trying to open a Xamarin built app in a native Xcode. In this case, how can I convert this Xamarin.forms iOS app into a native Xcode app so I can open it in an Xcode simulator? I will appreciate any helpful input
That is not how it supposed to work, You only need the mac to compile no to run the project. You need to connect your windows machine to the mac using your LAN and just send the code to it to compile it and retrieves back the code ready for you to open it in your windows machine iOS emulator. Then you can debug to inspect your elements as desired.

Resources