Disclaimer - Newbie
Just DL everything needed to get started with Flutter on my Windows 10 pc.
Flutter sdk -saved to a folder on my desktop
Git Google USB Driver
Visual Studio Code and its Flutter/Dart plug-ins
Android Studio and its Flutter/Dart plug-ins
Now I can start up Android Studio and pick an emulator (by default "no device connected" shows), hit run and the emulator works but if I go to my command line here is what I get and I followed it up with 'flutter emulators' 'flutter doctor'
When I tell it to check for emulators it tells me "To run an emulator, run 'flutter emulators --launch '"
Where do i find the ID?
C:\Users\admin\Desktop\Computer Science\Flutter Projects\first_app>flutter
run
No connected devices.
C:\Users\admin\Desktop\Computer Science\Flutter Projects\first_app>flutter
emulators
2 available emulators:
Nexus_5X_API_28_x86 • Nexus 5X • Google • Nexus 5X API 28 x86
Nexus_6P • Nexus 6P • Google • Nexus 6P
To run an emulator, run 'flutter emulators --launch <emulator id>'.
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
C:\Users\admin\Desktop\Computer Science\Flutter Projects\first_app>flutter
doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.8.2, on Microsoft Windows [Version
10.0.17134.285], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[√] Android Studio (version 3.2)
[√] VS Code (version 1.27.2)
[!] Connected devices
! No devices available
! Doctor found issues in 1 category.
Try this to start your emulator then you will se connected devices.
Once you have running emulator try running flutter app.
Right now you dont have any emulator running thays why its telling you No connected devices...
flutter emulators --launch Nexus_6P
Step 1: Go to the project folder in which you have created the flutter project in cmd (using cd Root/of/your/project)
Step 2: Run the following commands:
flutter emulators --create <whateverIdYouLike>
(Eg:- For my project I used `flutter emulators --create Nexus_6`)
This should give you the message:
"Emulator [Name] created successfully.'
Step 3: Type in the following command:
flutter emulators
You will see an emulator has been added successfully.
Step 4: Launch the emulator using the following command:
flutter emulators --launch <emulator id> //in my case, the id of the newly created emulator was "flutter_emulator"
For further info check
https://developer.android.com/studio/run/managing-avds
https://developer.android.com/studio/command-line/avdmanager
If you want to run app in your connect device through flutter, then first get the device name or id by typing
flutter devices
It will give you info
And run the app by running this command
Try to install Vysor on your system then connect it with mobile through USB cable now the mobile screen will be mirrored on the system, and will act as emulator.
Related
I was recently trying to run my flutter app. However, when I tried to do so, I got the following error:
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=3):
Application launch for 'com.[redacted]' did not return a valid pid
nor a launch error.
No such process
Command: /usr/bin/arch -arm64e xcrun simctl launch AA375D1F-5CFC-4D1B-B367-
4CB98488D7DA
com.[redacted] --enable-dart-profiling
--enable-checked-mode --verify-entry-points --observatory-port=0
Error launching application on iPhone 13.
To try and fix this, I ran flutter doctor, where I got the following errors:
See https://github.com/flutter/flutter/issues/6207 for more information
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4)
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] IntelliJ IDEA Community Edition (version 2022.1.2)
[✓] VS Code (version 1.67.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
I have already tried uninstalling and reinstalling flutter, and I am still getting the same error. I am genuinely confused as to why this happening, and I would really appreciate some help. Thank you in advance!
After running this command: $ sudo softwareupdate --install-rosetta --agree-to-license,
the problem appears to have been fixed. I ran flutter doctor, and this was the output:
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4)
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] IntelliJ IDEA Community Edition (version 2022.1.2)
[✓] VS Code (version 1.67.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
(Ignore the android issues- I intentionally did not install them).
I was getting the same error on my mac M1.
looks like,rosetta was not installed properly.
Install rosetta using.
sudo softwareupdate --install-rosetta --agree-to-license
My flutter app is crashing when I connect it to firebase and try to use it. It is only happening for this app(other apps are connecting fine). I am not sure why? Any suggestions would be greatly appreciated.I followed several tutorials and all of them did the same.
I have registered the app :
Provided bundle identifier
Attached the info-plist file
Flutter doctor :
[✓] Flutter (Channel unknown, 2.0.0, on Mac OS X 10.15.7 19H524 darwin-x64, locale en-IN)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed
instructions).
If the Android SDK has been installed to a custom location, please use
flutter config --android-sdk to update to that location.
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] Connected device (2 available)
Flutter run :
Running Xcode build...
└─Compiling, linking and signing... 30.6s
Xcode build done. 76.0s
Lost connection to device.
Activating Dart DevTools... 4.0s
looks like you haven't installed flutter correctly.
check https://docs.flutter.dev/get-started/install/macos
When I run the project directly in xcode 13 everything works fine, but when compiling with flutter run I get this error, I already tried deleting the DerivedData files.
Lock the password keychain.
Deleting the Pods and all their files.
Deleting the WorkSpace.
But nothing turns out to be useful, I am from a mac m1 with Monterrey operating system, I would like to know if someone has a possible solution for this error that I have seen so recurrent
Try following by running on specific device:
step1:- Run flutter devices, You will get list of devices connected. like this.
2 connected devices:
Redmi 4 • 81cea4a7d740 • android-arm64 • Android 7.1.2 (API
25)
Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28)
(emulator),
step2:- f you want to run in a specific device Run flutter run -d Device name or Device id
eg:- flutter run -d Redmi or flutter run -d 81cea4a7d740,
step3:- If you want to run in all devices than flutter run -d all.
I successfully run my app on simulator(iPhone 12, iOS 14.5), but when it running on real iPhone 11 Pro Max(iOS 14.7.1) I facing just a black screen. Here is the output from Xcode:
2021-09-16 18:48:00.155232+0300 Runner[2396:1009680] Metal API Validation Enabled
2021-09-16 18:48:00.244991+0300 Runner[2396:1009680] Could not load the "LaunchImage" image referenced from a nib in the bundle with identifier "xxx.yyy.zzz"
2021-09-16 18:48:00.353909+0300 Runner[2396:1009946] [VERBOSE-2:shell.cc(93)] Dart Error: Can't load Kernel binary: Invalid kernel binary format version.
2021-09-16 18:48:00.354015+0300 Runner[2396:1009946] [VERBOSE-2:dart_isolate.cc(170)] Could not prepare isolate.
2021-09-16 18:48:00.354185+0300 Runner[2396:1009946] [VERBOSE-2:runtime_controller.cc(382)] Could not create root isolate.
2021-09-16 18:48:00.354213+0300 Runner[2396:1009946] [VERBOSE-2:shell.cc(576)] Could not launch engine with configuration.
2021-09-16 18:48:00.367242+0300 Runner[2396:1009960] flutter: Observatory listening on http://127.0.0.1:54273/PrvtvZOQ8Wc=/
Flutter doctor:
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5.2 20G95 darwin-x64, locale
ru-BY)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from:
https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK
components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup
for detailed instructions).
If the Android SDK has been installed to a custom location, please use
flutter config --android-sdk to update to that location.
[✓] Xcode - develop for iOS and macOS
[✗] Chrome - develop for the web (Cannot find Chrome executable at
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
[✓] Connected device (2 available)
Xcode 12.5.1
UPDATED
To fix this, remove run rm -rf ~/flutter/bin/cache. Then run flutter run (you should run your app from terminal instead of IDE in order to Flutter download missing files). It's somehow works now.
Deleting the cache using rm -rf ~/flutter/bin/cache worked for me. This issue seems to have been caused by a bad Flutter installation. Running flutter pub get after deleting the cache should download the packages again and rebuild the project.
while trying to run a simple code using bloc I weren't able to test it because of that error , and before this it takes a lot of time trying to resolving dependencies and then post this error :
Unable to locate a development device; please run 'flutter doctor' for information about installing additional components.
and after running flutter doctor the result is :
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.8.2, on Microsoft Windows [Version 10.0.17134.345], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK 28.0.3)
X Android SDK file not found: C:\Users\aya sisy\AppData\Local\Android\sdk\build-tools\28.0.3\aapt.
[√] Android Studio (version 3.1)
[√] VS Code (version 1.28.1)
[√] Connected devices (1 available)
! Doctor found issues in 1 category.
Seems like the Android Sdk is not found by Flutter.
Did you set the correct ANDROID_HOME environment variable ?
It could also be coming from the path including a space "...\Users\aya sisy\AppData\...".
Can you try to move it to another location ?
The same problem happened to me, except I'm using Ubuntu 18.04, so check the following:
The solution was to remove adb from apt package manager. so see if you accidentally installed adb for windows other than the one that come with android_sdk.
and from the logs you posted, it's clear that there is something wrong inside the android_sdk path so try to move it to other directory : for ex C:\dev\android_sdk and run the following command
flutter config --android-sdk "C:\dev\android_sdk"
Hoping that helps.
Just check whether your 'Project SDK' is set in File -> Project Structure; under the section Project Settings -> Project.
For me, it was not set by default, and setting it solved the problem.