Error in Running Flutter Project
C:\Project\MyProject\Waste\1>flutter create app_1
Creating project app_1...
Resolving dependencies in `app_1`... (1.4s)
Downloading packages...
Got dependencies in `app_1`.
Wrote 129 files.
All done!
You can find general documentation for Flutter at: https://docs.flutter.dev/
Detailed API documentation is available at:
https://api.flutter.dev/
If you prefer video documentation, consider:
https://www.youtube.com/c/flutterdev
In order to run your application, type:
$ cd app_1
$ flutter run
Your application code is in app_1\lib\main.dart.
C:\Project\MyProject\Waste\1>flutter run
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter
project.
C:\Project\MyProject\Waste\1>cd app_1
C:\Project\MyProject\Waste\1\app_1>flutter run
Connected devices:
Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version
10.0.22631.3880]
Chrome (web) •
chrome • web-javascript • Google Chrome
127.0.6533.73
Edge (web) •
edge • web-javascript • Microsoft Edge
127.0.2651.74
[1]: Windows (windows)
[2]: Chrome (chrome)
[3]: Edge (edge)
Please choose one (or "q" to quit): 1
Launching lib\main.dart on Windows in debug mode...
Error: Unable to find suitable Visual Studio toolchain.
Please run `flutter doctor` for
more details.
C:\Project\MyProject\Waste\1\app_1>flutter doctor
Doctor summary (to see all details, run flutter doctor
-v):
[√] Flutter (Channel stable, 3.22.2, on Microsoft Windows
[Version 10.0.22631.3880],
locale en-US)
[√] Windows Version (Installed version of Windows is
version 10 or higher)
[!] Android toolchain - develop for Android devices
(Android SDK version 35.0.0)
X cmdline-tools
component is missing
Run
`path/to/sdkmanager --install "cmdline-tools;latest"`
See
https://developer.android.com/studio/command-line for more details.
X Android
license status unknown.
Run `flutter
doctor --android-licenses` to accept the SDK licenses.
See
https://flutter.dev/docs/get-started/install/windows#android-setup for more
details.
[√] Chrome - develop for the web
[X] Visual Studio - develop Windows apps
X Visual Studio
not installed; this is necessary to develop Windows apps.
Download at
https://visualstudio.microsoft.com/downloads/.
Please
install the "Desktop development with C++" workload, including all of
its
default
components
[√] Android Studio (version 2023.2)
[√] VS Code, 64-bit edition (version 1.88.1)
[√] Connected device (3 available)
[√] Network resources
! Doctor found issues in 2 categories.
1. cmdline-tools
component is missing
When you run Flutter doctor
Below is the Output
C:\Project\MyProject\Waste\1\app_1>flutter doctor
Doctor summary (to see all details, run flutter doctor
-v):
[√] Flutter (Channel stable, 3.22.2, on Microsoft Windows
[Version 10.0.22631.3880],
locale en-US)
[√] Windows Version (Installed version of Windows is
version 10 or higher)
[!] Android toolchain - develop for Android devices
(Android SDK version 35.0.0)
X cmdline-tools
component is missing
Run
`path/to/sdkmanager --install "cmdline-tools;latest"`
See
https://developer.android.com/studio/command-line for more details.
X Android
license status unknown.
Run `flutter
doctor --android-licenses` to accept the SDK licenses.
See
https://flutter.dev/docs/get-started/install/windows#android-setup for more
details.
[√] Chrome - develop for the web
[X] Visual Studio - develop Windows apps
X Visual Studio
not installed; this is necessary to develop Windows apps.
Download at
https://visualstudio.microsoft.com/downloads/.
Please
install the "Desktop development with C++" workload, including all of
its
default
components
[√] Android Studio (version 2023.2)
[√] VS Code, 64-bit edition (version 1.88.1)
[√] Connected device (3 available)
[√] Network resources
! Doctor found issues in 2 categories.
Resolve First Problem: Android Command Line tool
Android toolchain - develop for
Android devices (Android SDK version 35.0.0)
X cmdline-tools
component is missing
Run
`path/to/sdkmanager --install "cmdline-tools;latest"`
See
https://developer.android.com/studio/command-line for more details.
Solution
The solution for me was
opening Android Studio and going to SDK Manager, switch to the SDK Tools tab and check Android SDK Command-line Tools
(latest).
Don't forget to add to
your PATH the tools and platform-tools folder that are inside your SDK.
Eg: Open Edit Environment
PATH variables and add
1.
First Path is path for Flutter SDK
2.
Other two are for the platform
C:\Users\Gest\dev\flutter\flutter\bin
C:\Android\Sdk\platform-tools
C:\Android\Sdk\platforms
2. Accept
Licenses
After resolving above issue, Now
let’s run Flutter doctor again
You will see Next issue
Some Android licenses not accepted. To resolve this,
run: flutter doctor --android-licenses
C:\Project\MyProject\Waste\1\app_1>flutter doctor
Doctor summary (to see all details, run flutter doctor
-v):
[√] Flutter (Channel stable, 3.22.2, on Microsoft Windows
[Version 10.0.22631.3880], locale en-US)
[√] Windows Version (Installed version of Windows is
version 10 or higher)
[!] Android toolchain - develop for Android devices
(Android SDK version 35.0.0)
! Some
Android licenses not accepted. To resolve this, run: flutter doctor
--android-licenses
[√] Chrome - develop for the web
[X] Visual Studio - develop Windows apps
X Visual Studio
not installed; this is necessary to develop Windows apps.
Download at
https://visualstudio.microsoft.com/downloads/.
Please
install the "Desktop development with C++" workload, including all of
its default components
[√] Android Studio (version 2023.2)
[√] VS Code, 64-bit edition (version 1.88.1)
[√] Connected device (3 available)
[√] Network resources
! Doctor found issues in 2 categories.
Solution
Run Accept license command
flutter doctor
--android-licenses and Type “y” for all.
You will finally see
Accept? (y/N): y
All SDK package licenses accepted
No comments:
Post a Comment