Launch emulator from windows command line receive error G67247B7E - flutter

Newbee here. Trying to run the android emulator for the generic first_app flutter application.
Run flutter run -d windows
Receive:
C:\Development\Flutter\first_app>flutter run -d windows
Launching lib\main.dart on Windows in debug mode...
lib/main.dart(60,15): error G67247B7E: Expected ';' after this. [C:\Development\Flutter\first_app\build\windows\flutter\flutter_assemble.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(247,5): error MSB8066: Custom build for 'C:\Development\Flutter\first_app\build\windows\CMakeFiles\13756e3632117b79f6e0bc292bc438e0\flutter_windows.dll.rule;C:\Development\Flutter\first_app\build\windows\CMakeFiles\f154f6c681490929a1ff6491e40cd6b3\flutter_assemble.rule' exited with code 1. [C:\Development\Flutter\first_app\build\windows\flutter\flutter_assemble.vcxproj]
Building Windows application...
Exception: Build process failed.
Other information:
Flutter Doctor is clean. That took hours.
Running from Android Studio works.
Launching emulator works correctly
Have tried Flutter Clean, Flutter upgrade, Flutter Master.
Have tried running from powershell with the same error.
Any assistance welcomed.

First you can check if the emulator is running or not by this command
flutter devices
Then you can directly run your app through
flutter run -d device-id
In my case, it was
flutter run -d emulator-5554

All, on a whim, I deleted my first_app and created it again via flutter create first_app.
Immediately running flutter run, it works!

Related

Error: "Unable to find git in your PATH" only in terminal vs code and android studio

I have added
"C:\Program Files\Git\bin;C:\Program
Files\Git\cmd;C:\tools\dart-sdk;C:\Windows\System32;C:\Windows\System32\wbem;C:\src\flutter\bin;C:\tools\dart-sdk\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;"
in my environtment variables path. That's succesfull when i run flutter doctor in my powershell, but if i run in powershell in vscode, that error occured. The effect is i can't make a new flutter project in vs code and also in android studio.
i can run flutter doctor in my windows powershell
i can't run flutter doctor in my vscode powershell
run flutter doctor and make a new flutter project in vscode and android studio
As I can see, in the powershelgl, you're running on the C drive and in VSCode, it's running on the F drive where flutter is not installed.. This is probably causing the issue.
Hope you find this helpfull.

Can't sync android emulator with flutter project

Could Not Find C:\Users\Mohammed\AppData\Local\Android\sdk\platform-tools\AdbWinApi.dll.dat
The directory name is invalid.
W/FlutterActivityAndFragmentDelegate( 9139): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.
Error waiting for a debug connection: ProcessException: adb returned error:
The directory name is invalid.
Could Not Find C:\Users\Mohammed\AppData\Local\Android\sdk\platform-tools\AdbWinApi.dll.dat
Command: C:\Users\Mohammed\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 forward tcp:0 tcp:42601
Error launching application on Android SDK built for x86.
Exited (sigterm)
I solved this issue by the following 3 steps:
1 remove the sdk and emulator.
2 install again the sdk and emulator.
3 restart my computer
and then then solved it

Error: ADB exited with exit code 1 - remedy?

I am trying to debug a demo app of flutter in vscode where the error is showing for ADB exit with code 1
performing streamed install. I uninstall the existing Flutter demo app.
You should try with these three stuff:
Check out if your emulator memory full.
Check your package name is alright
Clean your flutter and re-run
flutter clean
flutter run
as APK built is Successful there is no issue with the code.
there is something wrong with the device
check u enabled USB debugging
check u enabled install over USB in developer option
few devices don't have to enable install over USB.
then
flutter clean && flutter pub get
uninstall the app in the device and run
flutter run -d <device name>
emphasized text

Issue with Flutter commands after Flutter upgrade

My project was working okay before I got Flutter upgrade prompt. After accepting to upgrade flutter, I started getting the following exception and now with every flutter command I get this exception. Also since that problem started Android Studio does not pick up any running emulator. So basically, I'm stuck, please help. It just displays "Loading..." instead of displaying the running Emulator.
Version Information:
Android Studio 3.4.2 • Flutter plugin io.flutter 38.2.1 • Dart plugin 183.6270
I've change the permission for git.EXE to allow for read, execute etc but this has not helped.
ERROR MESSAGE:
CreateProcessW failed 5
Unhandled exception:
ProcessException: Access is denied.
I have faced the same issue after running the flutter upgrade command
Remove exiting flutter SDK from the directory "https://flutter.dev/docs/get-started/install" and download again and run the following command
flutter doctor -v
After running the flutter upgrade command in the Windows CMD I faced the same issue.
I then tried to upgrade Flutter SDK using the Android Studio terminal and it upgraded successfully.

Start android emulator without starting Android Studio for flutter applications

Is it possible to start emulator in such a way flutter doctor detects it and flutter run should able to deploy to flutter code ?
I tried emulator -avd *image name* but flutter doctor fails to detect running emulator and flutter run does not deploys code on emulator.
In notepad type the following and save it as "file_name.bat" and run it:
SET builddir=%~dp0
SET EX="C:\Users\user_name\AppData\Local\Android\Sdk\emulator\emulator.exe"
CALL %EX% -avd emu_name -partition-size 512 -feature WindowsHypervisorPlatform
pause
emu_name is the name of your emulator.
first you must change directory of your command line to ${android_SDK_DIR}\emulator
most of the time its in c:\users\${yourUserName}\AppData\Local\Android\SDK\
and run emulator -list-avds and it show you your emulator that you create before in android studio then just run emulator #${your emulator name that shows on the list} for example emulator #Nexus6_API_27
remember that maybe your android sdk folder directory was change on install SDK and if you don't create emulator in android studio before , the list will be empty so before you run command you must create AVD in your android studio
It looks like an adb issue, not of the Flutter doctor issue. Because if adb is running perfectly then it would show you a list of devices from android studio or from flutter devices or by running a adb devices command.
You can try restarting adb using commands:
adb kill-server and
then adb start-server
I think the easiest method I found is you just go to cmd
flutter emulator -- launch <emulator id
it will run and will be detected by your intelli j
I have to get an answer in here somehow, even if it's to offer that the command may also be plural. Yes, indeed, you can run "flutter emulators" from your flutter\bin directory (if you haven't added to system PATH yet) and voila...
PS C:> flutter emulators 1 available emulator:
Pixel_2_API_28 • pixel_2 • Google • Pixel 2 API 28
To run an emulator, run 'flutter emulators --launch '. To
create a new emulator, run 'flutter emulators --create [--name xyz]'.
You can find more information on managing emulators at the links
below: https://developer.android.com/studio/run/managing-avds
https://developer.android.com/studio/command-line/avdmanager