flutter is not recognised even after setting environment variables - android

When I do "flutter doctor" on cmd this is the error I receive:
where' is not recognized as an internal or external command operable program or batch file unable to locate git
Note that git --version gives me git version 2.28.0.windows.1
These are the things I tried
1.Reinstalling git
2.Updating Powershell to 5.0 as I run windows 7 SP1 and flutter requires Powershell 5.0 and greater
3.Tries resetting path variables
Here are my path variables.
USER ENV VAR:
C:\Program Files\MySQL\MySQL Shell 8.0\bin\;C:\Users\DELL\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\DELL\AppData\Roaming\npm;C:\src\flutter\bin
SYSTEM ENV VAR:
C:\Program Files\Java\jdk-14\bin;%PYTHON_HOME% ; C:\Users\DELL\AppData\Local\Programs\Python\Python37;C:\Program Files\MySQL\MySQL Server 8.0\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\Git\bin\git.exe;C:\Windows\System32 ;%systemroot%\System32\WindowsPowerShell\v1.0\
I am not able to find where exactly I am going wrong.
I am new to this.Any help would be appreciated.I have been trying this from 3 days nothing helps.
UPDATE
ADDING FLUTTER PATH TO SYSTEM VARIABLE WORKED FOR ME . Though now I have another set of issues as you can see in the image.I have android studio installed ; Have installed the dart and flutter plugin.Still I am getting the error

Make sure this path of flutter %/flutter/bin exists in the environment variable and you have restarted the terminal (maybe the system also).
Update :
Can You run flutter doctor -v using flutter_console and show us the error message:

Comparing with my enviroment variables it seems like you don't have java jdk installed, otherwise i see no problem . However i will share my variables . Another way of finding what is wrong is opening cmd in the flutter folder and lanuching flutter_console.bat inside the cmd, that way it will not close and it will show the error if there is any
USER ENV:
C:\Users\USER\AppData\Local\Microsoft\WindowsApps;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Users\USER\AppData\Local\Programs\Microsoft VS Code\bin;D:\flutter\bin;C:\Users\USER\.gradle\wrapper\dists\gradle-6.1.1-all\cfmwm155h49vnt3hynmlrsdst\gradle-6.1.1\bin;C:\Program Files\Java\jdk1.8.0_261\bin;C:\Users\USER\AppData\Local\Android\Sdk\tools\bin;
SYSTEM ENV:
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%SYSTEMROOT%\System32\OpenSSH\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\Git\cmd

Related

" 'git rev-parse HEAD ' is not recognized" error when flutter doctor, but still works normally?

I've been trying to setup flutter on my laptop with Android studios dolphin (using Windows 11), but I've been running into some troubles with using flutter doctor and agreeing to the android licenses. Running the flutter doctor command produces the below error message, however it still runs normally :
I ignored it and tried to run the --android-licenses command as it suggested, but the below was returned :
'git rev-parse HEAD' is not recognized as an internal or external command, operable program or batch file'
'DIR /B /O:D "C:\Users\jerry\Downloads\flutter_windows_3.3.10-stable\flutter\packages\flutter_tools\pubspec.yaml" "C:\Users\jerry\Downloads\flutter_windows_3.3.10-stable\flutter\packages\flutter_tools\pubspec.lock"' is not recognized as an internal or external command'
The error in red says 'Android sdkmanager tool was found, but failed to run
(C:\Users\jerry\AppData\Local\Android\Sdk\cmdline-tools\latest\bin\sdkmanager.bat): "ProcessException: Cannot find file specified'.
Apologies for the Japanese.
Any ideas on how this could be? I can still access git through the cmd, and have added the bin and cmd paths to the PATH variable in the Environmental variables already.
I have another question posted regarding details about the issue with agreeing to the android licenses here :
'Android sdkmanager tool found, but failed to run' for flutter doctor --android-licenses
and I would be beyond grateful if someone could help me with that as well.
Solutions I've attempted :
Renaming the ComSpec from "%SystemRoot%\system32\cmd.exe;" to "C:\Windows\system32\cmd.exe" as suggested by this forum https://github.com/flutter/flutter/issues/30638
However the opposite is proposed by this thread : Flutter doctor script throws errors and then crashes which is what my ComSpec is set to now at the time of capturing this screenshot.
Checking my jdk - My JAVA_HOME is set to C:\Program Files\Java\jdk1.8.0_351
Added a FLUTTER_HOME variable, set to C:\Users\jerry\Downloads\flutter_windows_3.3.10-stable\flutter

Flutter Project crashes when I create it and shows the cmd and disappears quickly

When I start a new flutter project or run any flutter commands in git bash or in the cmd it shows another cmd window and writes a lot of things in it quickly then disappears and the window that I wrote the flutter command in it doesn't accept any other commands
OS: Windows 7
what happened with more details:
1-I installed PowerShell version 5.1 as seen in installation documentation in Flutter Docs.
image of powershell
2- I installed JDK and sit its PATH User variable to
C:\Program Files\Java\jdk-14.0.1\bin
3- I installed flutter SDK and sit its PATH User variable to
C:\src\flutter\bin
4-I downloaded android studio and SDKs and sat ANDROID_HOME user variable manually to
C:\Users\Bassam\AppData\Local\Android\Sdk
image of the downloaded SDKs
5-After these steps the problem showed up
I took a photo of what cmd says
flutter doctor result (best image I could take)
system variable Path:
%SystemRoot%\system32;
%SystemRoot%;
%SystemRoot%\System32\Wbem;
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
%ANDROID_HOME%\tools;
%ANDROID_HOME%\tools\bin;
%ANDROID_HOME%\platformtools;
C:\src\flutter\bin;
%systemroot%\System32\WindowsPowerShell\v1.0\;
C:\Program Files\Git\cmd`
User variable Path:
C:\Program Files\Java\jdk-14.0.1\bin;
C:\src\flutter\bin;
C:\Users\Bassam\AppData\Local\Programs\Microsoft VS Code\bin;

ANDROID_HOME environment variable issues with Appium

I am trying to run Appium on the command line with OSX El Capitan to test an Android application. I have been able to use Appium many times with the GUI version but have not had the same luck in the terminal. The issues I am facing stem from setting the $ANDROID_HOME environment variable. I have read other posts regarding this problem but the solutions have not helped me.
I have the following in my bash_profile :
export ANDROID_HOME=/Users/adamjakiela/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
I then run source ~/.bash_profile and am able to start the SDK by running the android command. I can also print the environment variable:
echo $ANDROID_HOME
/Users/adamjakiela/Library/Android/sdk
But then, when I run Appium on the command line I receive the following message which eventually leads to other problems:
warn: The ANDROID_HOME environment variable is not set to the Android SDK root directory path.
I can also run the Appium doctor and see the following:
Running Android Checks
✖ ANDROID_HOME is not set
Appium-Doctor detected problems. Please fix and rerun Appium-Doctor.
Additionally, I have installed all the build tools for the applicable versions of Android and have had no problem build my applications or using the Appium GUI version by pointing it to the $ANDROID_HOME location.
Why are the errors shown by Appium inconsistant with the fact that the $ANDROID_HOME environment variable is set and that other applications are able to use the Android SDK?

PhoneGap installation issues

I am trying to setup PhoneGap on a new Windows 7 machine. Downloads and installs all go fine. In a command prompt I type java, adb, android and they respond correctly, but when I run the ant command it gives me
1. ant is not recognized as an internal command, operable program or batch.file
also
when I follow the PhoneGap documnentation path syntax for Windows:-
C:\path\to\cordova-android\bin\create.bat C:\path\to\my_new_cordova_project com.example.cordova_project_name CordovaProjectName
I receive the following following prompt:-
The filename, directory name or volume label name syntax is incorrect.
I am not to sure where to go from here as I have also appended JAVA_HOME and ANT_HOME to my environment variables when I run create.bat with the variables.
I am using PhoneGap 2.9.0 (have previously used PhoneGap 2.9.1), eclipse/ADT and Win 7.

android' is not recognized as an internal or external command

I'm trying to get the new GCM service to work for me, so I've been following the demo as described here: http://developer.android.com/guide/google/gcm/demo.html
So far, everything works well. However, I'm supposed to build the ant files using the command line now, and that's where things stop working.
For some reason, this command $ android update project --name GCMDemo -p . --target android-16 gives me a very nice
'android' is not recognized as an internal or external command,
operable program or batch file.
Normally this can be fixed easily with a quick Google search, but I haven't found a single other user with this problem. Could someone tell me what the problem is?
My educated guess is that I need to add the Android tools folder to my PATH, but I'd rather be sure first.
Your guess is correct, just add the folder containing android.bat(tools folder) to the PATH. Otherwise the system will not be able to find the program.
Other possibility is change directory (using cd) to the tools folder, and execute the command from there. Since the current directory (whatever it is) is usually in the PATH, the system will find it. But this is not handy, because you frequently want to execute this command being in a different directory.
Find android.bat on your system. On mine (win 8 x64) it's under C:\Users\{username}\AppData\Local\Android\sdk\tools\android.bat
Open a command console, and use the 'doskey' command:
doskey android=C:\Users\{username}\AppData\Local\Android\sdk\tools\android.bat $*
This will continue to work in the open command console. To make it permanent is more difficult: http://darkforge.blogspot.com/2010/08/permanent-windows-command-line-aliases.html
You can also try adding it to your PATH as another poster suggested, but that didn't work for me. I recommend an easy gui for doing it, such as https://patheditor2.codeplex.com/
In Windows 7, navigate to
Control Panel\System and Security\System > advance system settings > environment variables
and update the path to include the following:
<android-root>\android-sdk-windows\tools
Use semicolons to separate paths if more than one exist.
On Windows 10, add both:
C:\Users\Parag Jain\AppData\Local\Android\sdk\tools
C:\Users\Parag Jain\AppData\Local\Android\sdk\build-tools
to the PATH environment variable of System and User. Make sure that you close your command prompt and restart a new prompt and then try the command.
Compiling previous answers I did the following to get Android SDK and gradle working (You need gradle working anyway to compile your Android project):
Prerequisites. You have Java jdk, Android SDK and gradle installed in the folders like I found on my computer. Please, check it:
C:\Program Files\Java\jdk1.X.X_XX\
C:\Users{username}\AppData\Local\Android\sdk\
C:\Program Files\Android\Android Studio\gradle\gradle-X.X\
Set up three new system variable (Control Panel\System and Security\System Advance system ->settings->environment variables-system variables). Do not forget to change java and gradle versions.
JAVA_HOME C:\Program Files\Java\jdk1.X.X_XX
ANDROID_HOME C:\Users\{username}\AppData\Local\Android\sdk
GRADLE_HOME C:\Program Files\Android\Android Studio\gradle\gradle-X.X\
Add the following paths to system paths (Control Panel\System and Security\System Advance system ->settings->environment variables-system variables):
%JAVA_HOME%
%ANDROID_HOME%\tools\
%ANDROID_HOME%\platform-tools
%GRADLE_HOME%\bin
Close and open once again your Dos application (Cmd terminal, etc.). You might want to REBOOT your computer, to make sure, that the system sees the variables. If you do not want to reboot, you can use the advice of #wordsforthewise
doskey android=C:\Users\{username}\AppData\Local\Android\sdk\tools\android.bat $*
Check if Android SDK and gradle work properly with the terminal commands
$ java -version
$ android list target
$ gradle -v
What worked for me:
Setting up the ANDROID_HOME variable as a System variable instead of a user variable.
I am using Windows 10, not sure if that matters.
I resolved this issue permanently using the below steps.
OS version : windows 7 64 bit
Solution : Set environment variable for android sdk and gradle
Step 1: Create new "ANDROID_HOME" User Variable
Variable Name: ANDROID_HOME
Variable Value C:\Users{user_name}\AppData\Local\Android\sdk\
Step 2: Create new "GRADLE_HOME" User Variable
Variable Name: GRADLE_HOME
Variable Value C:\Program Files\Android\Android Studio\gradle\gradle-x.x\
*Do not forget to change and gradle versions.
Step 3: Create "ANDROID_HOME" System Variable
Variable Name: ANDROID_HOME
Variable Value C:\Users{user_name}\AppData\Local\Android\sdk\
Step 4: Create new "GRADLE_HOME" System Variable
Variable Name: GRADLE_HOME
Variable Value C:\Program Files\Android\Android Studio\gradle\gradle-x.x\
*Do not forget to change and gradle versions.
Reopen the command prompt and confirm below command output :
1. gradle -v
2. android list target

Categories

Resources