Where is not recognized as an internal or external command operable program or batch file android studio?

All we need is a simple explanation of the problem, which is provided below.

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.

Let’s Solve it:

This is a common error many developers questioned us about it. So we write the explanation above. You just have to apply the suggested solution to your code and it will do for you. If you still getting this error after applying this code then comment below we will get back to you with the new method.

Solution 1

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.

Solution 2

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/

Solution 3

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.

Solution 4

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.

Where is not recognized as an internal or external command operable program or batch file android studio?

Solution 5

Compiling previous answers I did the following to get Android SDK and gradle working (You need gradle working anyway to compile your Android project):

  1. 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\
  2. 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\
  3. 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
  4. 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 $*
  5. Check if Android SDK and gradle work properly with the terminal commands

    $ java -version $ android list target $ gradle -v

Solution 6

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.

Solution 7

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

Note: You are free to use these solutions for your personal use. We recommend you apply the first solution to your code because it was tested in our system before posting it on this page.

We are always trying to help the developer community, So we made their work easy. Basically, we collected these data from stackoverflow.com, As it is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0.

How do I fix not recognized as an internal or external command operable program or batch file?

You can resolve this issue in three ways: First, use the full path of the executable file to launch the program. Second, add the program path to Windows environment variables. Finally, move the files to the System32 folder.

How do you fix next is not recognized as an internal or external command?

About the Unrecognized Command npm run dev > dev > next dev 'next' is not recognized as an internal or external command, operable program or batch file. Good news, the solution is actually just to install the Next. js npm package.

Where is not recognized as an internal or external command operable program or batch file in flutter?

2. Go to My Computer Properties > Advance System Setting > Environment Variables. In this way, you can solve 'flutter' is not recognized as an internal or external command error in Windows OS.

Where is not recognized as an internal command?

The “not recognized as internal command” error usually occurs because the computer cannot find the executable file it is trying to start. However, you can provide the full path to your executable and then it should run without any problem. Launch a Command Prompt window on your PC.