Flutter runs only from C:\Windows\system32> folder - flutter

I have just installed flutter 3 on my Windows machine. However, it gives out the following error when running any flutter command.
'where' is not recognized as an internal or external command, operable program or batch file. Error: Unable to find git in your PATH.
However, when I run flutter doctor in the C:\Windows\system32 folder, whether using administrative privileges, I get the following output:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.3.1, on Microsoft Windows [Version 10.0.19044.1889], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Professional 2022 17.3.3)
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.71.0)
[√] Connected device (3 available)
[√] HTTP Host Availability
• No issues found!
Flutter projects also do not open in Android Studio.
Somebody, please help.
Please help me with how I can run flutter.

add to your PATH c:\windows\system32
I had the same problem and that's how I solved it

Related

Dart: Uploading data (Uint8List) to PosgreSQL

I am trying to upload a Uint8List to my PosgreSQL database but I am getting this error: Write failed (OS Error: An established connection was aborted by the software in your host machine... I've turned off all windows firewalls and antiviruses and it still doesn't let me:
Flutter Doctor:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.0.2, on Microsoft Windows [Version 10.0.19044.1766], locale en-US)[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.4)
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.68.1)
[√] Connected device (3 available)
[√] HTTP Host Availability
• No issues found ```

Installation Process of Flutter

C:\Users\aakas>flutter doctor
'Information' is not recognized as an internal or external command,
operable program or batch file.
'Information' is not recognized as an internal or external command,
operable program or batch file.
Error: Unable to find git in your PATH.
[1]How to fix it, I already set the environment variable and dart is working but flutter is not working
Have you updated your Flutter path in your Environment variables?
update your path in environment variables and restart your system and run again flutter doctor in Command Terminal.
To run Flutter on your device properly you have to install these following things first:
Android Studio
Chrome (Browser)
Git
IntelliJ (Not sure if it's a must or not but flutter doctor does check for it)
Otherwise, you'll face difficulties for not installing any of them.
The following is the result I got after running flutter doctor on my device and it shows the things it checks for Flutter to be properly running.
[√] Flutter (Channel stable, 2.6.0-11.0.pre, on Microsoft Windows [Version 10.0.19043.1288], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[√] Chrome - develop for the web
[√] Android Studio (version 2020.3)
[√] IntelliJ IDEA Community Edition (version 2021.2)
[√] VS Code (version 1.62.1)
[√] Connected device (2 available)

[tag][!] Android Studio (not installed) [tag], Error when run flutter doctor on PC

i have installed latest version of android studio and flutter.
but when i run flutter doctor -v it shows following error [!] Android Studio (not installed)
flutter doctor output:
[√] Flutter (Channel stable, 2.2.0, on Microsoft Windows [Version 10.0.19043.985], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[!] Android Studio (not installed)
[√] VS Code (version 1.56.2)
[√] Connected device (2 available)
! Doctor found issues in 1 category.
PS: flutter & dart plugins installed!
If android studio is installed correctly you can run the following command to change the path of android-studio installation:
flutter config --android-studio-dir="ANDROID STUDIO PATH HERE"
after this open a new terminal and run flutter doctor and you should see [√] Android Studio (version x.x.x)
you can install flutter&dart plug,and then restart.
android studio is installed correctly you can run the following command to change the path of the android-studio installation: >flutter config --android-studio-dir="C:\Program Files\Android\Android Studio" // please use your Android Studio Path.

Flutter doctor android-studio-dir problem

When I run flutter doctor, it renders these 2 errors and I can't find a way to get over them:
C:\Users\Work pc>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.5, on Microsoft Windows [version 10.0.19041.928], locale fr-CH)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
X Cannot execute C:\ProgramData\Oracle\Java\javapath\java.exe to determine the version
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[!] Android Studio
X android-studio-dir = C:\Program
X Android Studio not found at C:\Program
[√] VS Code (version 1.55.2)
[√] Connected device (2 available)
! Doctor found issues in 2 categories.
I mainly have difficulties with solving the second problem, related to android studio.
Thanks a lot!
try running this command on your terminal flutter config --android-studio-dir=[path/to/android-studio]
Try running this command in your cmd
flutter config --android-studio-dir=""
Then restart all your editors for them to load new settings

Android studio is not installed when using flutter doctor

I am running flutter doctor command. But it is saying android studio is not installed many times. I tried flutter config --android-studio-dir=/home/khamidjon/.android, and many more paths I tried to show but to no luck.
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.1, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Chrome - develop for the web
[!] Android Studio
✗ android-studio-dir = /home/khamidjon/.android
✗ Unable to find bundled Java version.
[✓] IntelliJ IDEA Community Edition (version 2020.3)
[✓] Connected device (1 available)
! Doctor found issues in 1 category.
My question is what location should be shown for PATH in flutter config --android-studio-dir='PATH'?
For Android Studio installed with Flatpak, i found this config to work:
flutter config --android-studio-dir=/path/to/home/.local/share/flatpak/app/com.google.AndroidStudio/current/active/files/extra/android-studio
Where path/to/home is the path to your home directory.
(Ubuntu 21.10/Pop!_OS)
Snap packages are installed under /snap/appname/ with subdirectories for each new version. Try this to reslove the issue, it worked for me.
flutter config --android-studio-dir="/snap/android-studio/current/android-studio"
The current directory will make sure that it always points to the latest version.
if you have Androind Studio installed in your home directory /home/khamidjon set up PATH like this: /home/khamidjon/android-studio/bin
to append variable in Linux use command
export PATH=$PATH:/some/new/path
to check your PATH use
echo $PATH
In my case snap packages can retain old versions of the program. So inside /snap/android-studio There were 2 versions of android studio inside directories /snap/android-studio/99 and /snap/android-studio/100. So I showed one of these paths: directory /snap/android-studio/100/android-studio with latest version.
So I ran:
flutter config --android-studio-dir=/snap/android-studio/100/android-studio
flutter doctor
Result:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.1, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Chrome - develop for the web
[✓] Android Studio
[✓] IntelliJ IDEA Community Edition (version 2020.3)
[✓] Connected device (2 available)
• No issues found!
In windows
if your Android Studio install by default, you can use this command
flutter config --android-studio-dir="C:\Program Files\Android\Android Studio"
after this command, flutter can found android studio, but the plugin can't...
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.20.2, on Microsoft Windows [Version 10.0.18363.1016], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[!] Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.48.0)
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
In Linux (Ubuntu)
Note: for those who are facing the problem in Ubuntu and Android Studio is installed with snap:
flutter config --android-studio-dir="/snap/android-studio/current/android-studio"
Note: for those who are facing the problem in Ubuntu and Android Studio is installed with JetBrains Toolbox:
flutter config --android-studio-dir=/home/myuser/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7042882
Where ./201.7042822 matches the current version of Android Studio installed. You'll have to check which one you have and update it in the command above.