can't run flutter project on chrome - flutter

I created a sample flutter project and I want to see the result in chrome.
when I run main.dart on chrome I get a white blank page as result!
here is my flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
Flutter (Channel stable, 3.3.0, on Ubuntu 22.04.1 LTS 5.15.0-56-
generic,locale en_US.UTF-8)
Android toolchain - develop for Android devices
cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more
details.
Chrome - develop for the web
Linux toolchain - develop for Linux desktop
clang++ is required for Linux development.
It is likely available from your distribution (e.g.: apt
install clang), or can be downloaded from
https://releases.llvm.org/
CMake is required for Linux development.
It is likely available from your distribution (e.g.: apt
install cmake), or can be downloaded from
https://cmake.org/download/
ninja is required for Linux development.
It is likely available from your distribution (e.g.: apt
install ninja-build), or can be downloaded from
https://github.com/ninja-build/ninja/releases
pkg-config is required for Linux development.
It is likely available from your distribution (e.g.: apt
install pkg-config), or can be downloaded from
https://www.freedesktop.org/wiki/Software/pkg-config/
Android Studio
android-studio-dir =
/home/mbunderline76/.local/share/JetBrains/Toolbox/apps/IDEA-
U/ch-0
Unable to find bundled Java version.
IntelliJ IDEA Ultimate Edition (version 2022.3)
Connected device (2 available)
HTTP Host Availability
Doctor found issues in 3 categories.
any idea what is going on?
by the way i'm using Intellij Idea Ultimate

Fix these issues first.
Flutter command Line tools
Flutter Java Bundled Link
then again run flutter doctor to make sure these errors are gone.
then run flutter -v -d chrome run Or Pick " Chrome Web " in your Vscode or AndroidStudio.
Hope this works, Enjoy.

Related

Flutter shows some errors

I am trying to connect my flutter app to my phone but it doesn't work...
I wrote flutter doctor in the terminal and it shows me some errors:
[!] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
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 for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
I am using VS code (if it's matters).
What is the path to SDK manager?
Why is it said to me that "Visual Studio not installed" if that wrote in the VS code terminal?
Thanks all!
Visual Studio can work no problem, first you need to install Android Studio, open Android Studio, open SDK Manager, install Android SDK version 32.1.0-rc1 from SDK Tools, then open CMD(command prompt) run flutter doctor --android-licenses , prass enter y enter y enter..., then write flutter doctor and see run problem solve . Thank You.

Flutter Doctor - Android toolchain (Missing)

I ran a fresh installation of the latest version of Flutter and then ran flutter doctor. Everything is fine but I always get this error (this is why I am reinstalling flutter):-
[!] Android toolchain - develop for Android devices (Android SDK version 31.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.
I have tried several fix like going to this website -> https://www.programsbuzz.com/article/set-android-environment-variable-path-windows-10 but nothing works. PLease help me.
You can either run flutter doctor --android-licenses and it will install the command line tools or if it is giving an error regarding the path of sdkmanager then you can install Android Studio and install command line tools directly from there.
Go to SDK Manager > Android SDK > Check on Android SDK Command-Line Tools
Then click on apply and it will install all the required dependencies.
Run flutter doctor to check if everything is installed successfully or not.
Go to your Terminal and Simply Run :
flutter doctor --android-licenses
It will solve this issue .

Flutter 2.5 cannot recognise sdkmmnager, although everything was fine before upgrading

So yesterday i upgraded flutter to 2.5 and flutter doctor said android-licenses status unknown. So, I ran flutter doctor --android-licenses and it says that sdkmanager not found although the previous version which was probably 2.2.3 didn't say anything like that. I did not install cmdline-tools the "android studio" way. I followed a guide and downloaded the android cmdline-tools.zip file, unpacked it inside "android" folder, made a new tools folder (inside android folder) and copied everything from the android folder to the tools folder. Then I set path to sdkmanager, platform-tools and emulator.
After that I installed platform-tools 31.0.0, android-sdk 31.0.0 and an emulator. At that time flutter was able to recognise sdkmanager and it gave no errors. How do i solve this? Did something related to where the sdkmanager should be located change?
The output of flutter doctor:
[✓] Flutter (Channel stable, 2.5.0, on Arch Linux 5.13.13-zen1-1-zen, locale
en_IN.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/linux#android-setup for more
details.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
[✓] Connected device (1 available)
and the output of flutter doctor --android-licenses:
cmdline-tools are installed to resolve this.
Also i can run the default app just fine.
I am running linux.
For Windows, you can use this command:
flutter config --android-studio-dir="Path to your Android Studio"
Double check that inside Android Studio > SDK Manager > SDK Tools, Android SDK Command-line Tools are installed.

Flutter Desktop Linux build failed

When I try to build my app to Flutter Desktop its fail with this message:
Launching lib/main.dart on Linux in debug mode...
Exception: Build process failed
My configuration is:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.19.0-2.0.pre.142, on Linux, locale pt_BR.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 3.6)
[✓] Connected device (1 available)
Can anyone know how to fix this?
Thanks
I had the same issue.
First I ran flutter run -v -d linux, I followed the log and I noticed it an OS Error
Unhandled exception:
FileSystemException: Setting current working directory failed
So, I firstly switch to the master channel (solution for some people), run flutter upgrade and I was getting the same error.
My working dir is /home/xylia/Flutter\ Apps/github_pages and I felt it might be the space from the folder name (I had an issue like that once), so I created a new folder without space and it worked!
I am not totally sure if changing channel to master helped but there is no harm in doing it
I don't know if you already found a solution but for everyone having this problem, I solved it by doing the following:
Inside your project root directory delete the linux folder, like rm -rf linux.
Run flutter clean to delete the build folder and other related files.
Then run flutter create . to make flutter recreate your linux folder.
I had the same problem my fix was to create/run the flutter project on primary SSD/HDD drive.
In my case, it was a dependencies problem. I was trying to use svg_flutter package in a desktop app (which is not supported).
Try running flutter run -v -d linux and check if any error message corresponds with new packages that you added recently.

`flutter doctor` report error `Android toolchain - develop for Android devices`

I run flutter doctor in my Mac:
there comes an issue below:
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14 18A391, locale
zh-Hans-CN)
[✗] 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/setup/#android-setup for detailed
instructions).
If the Android SDK has been installed to a custom location, set
ANDROID_HOME to that location.
You may also want to add it to your PATH environment variable.
But I have installed Android SDK in my Mac this path /Users/delo/software/android-sdk-macosx.
before ask this question I have follow this post to add the /Users/delo/software/android-sdk-macosx in my /etc/paths.d/android-sdk file, and this post add path-to-android-sdk/tools and path-to-android-sdk/platform-tools.
but there is still have this issue.
EDIT-01
This is the echo $PATH:
/Library/Frameworks/Python.framework/Versions/3.5/bin:/Users/delo/.rvm/gems/ruby-2.3.3/bin:/Users/delo/.rvm/gems/ruby-2.3.3#global/bin:/Users/delo/.rvm/rubies/ruby-2.3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Users/delo/software/android-sdk-macosx:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS:/opt/local/bin:/usr/local/mysql/bin:/usr/local/Cellar/go/1.7.6/bin:/Users/delo/.rvm/bin:/usr/local/sbin:/Users/delo/software/android-sdk-macosx/tools:/Users/delo/software/android-sdk-macosx/platform-tools
I see your $PATH have add the ANDROID SDK PATH and its tools and platform-tools PATH, but did not config the flutter PATH, but you can still run flutter doctor command, there should be copy error.
in your case, there must be ANDROID_HOME variable config error,
you should follow the correct way :
append the
export PATH=/path/to/your/flutter/bin:$PATH
export ANDROID_HOME="/path/to/your/android-sdk"
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
to
then you just source ~/.bash_profile.
I believe the problem is in the PATH of Android SDK Command-Line Tools and Android SDK Build Tools.
Put the lines at the end of the .bachrc file:
export ANDROID_HOME="/home/XXX/Android/Sdk/"
export PATH="$PATH:${ANDROID_HOME}cmdline-tools/latest/bin/:${ANDROID_HOME}build-tools/33.0.0/:${ANDROID_HOME}platform-tools/"
Note that latest and 33.0.0 must be changed according to your installation.