Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 370
Sander van't Veer Avatar asked Jul 05 '12 18:07

Sander van't Veer


People also ask

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

So, all one needs to do is to open Android Studio, click on File>Settings. In the next window, under Tools, click on Terminal. Then enter the complete location to adb in the Start Directory. Restart Android Studio and your adb command should execute now.

How do I fix the ADB is not recognized?

Set the path of adb into System Variables. You can find adb in "ADT Bundle/sdk/platform-tools" Set the path and restart the cmd n then try again. You can also go to the dir where adb.exe is located and do the same thing if you don't wanna set the PATH.

Is not recognized as an internal or external command bat?

The “is not recognized as an internal command” error usually occurs because the computer can't find the executable that you're asking it to launch. However, you can provide it with the full path to your executable file and it should then be able to run it without any issues. Launch a Command Prompt window on your PC.


2 Answers

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.

like image 147
User Avatar answered Oct 25 '22 01:10

User


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/

like image 38
wordsforthewise Avatar answered Oct 24 '22 23:10

wordsforthewise