2

I'm having precisely the same issue as this person:

android' is not recognized as an internal or external command

However, I have also set the PATH environment variable (Windows 7) as recommended in the answer to the above post. In particular, I have:

C:\Users\p\AppData\Local\Android\android-sdk\tools

and

C:\Users\p\AppData\Local\Android\android-sdk\platform-tools

In addition, I have set %ANT_HOME%\bin and %JAVA_HOME%\bin. I have checked that the android.bat is indeed in the tools directory pointed to, that the PATHEXT variable contains ".bat", and I have restarted the command prompt. And yet 'android' is not recognized.

Does anyone have an idea what might be the problem? Many thanks in advance!

Community
  • 1
  • 1
user2447501
  • 53
  • 1
  • 1
  • 6
  • Try to cd to the location of platform-tools from your command prompt: cd C:\Users\p\AppData\Local\Android\android-sdk\platform-tools . Usually it's the path that is misspelled. – verybadalloc Jun 04 '13 at 12:11
  • Thanks a lot for your response. I'm pretty certain the path is spelled correctly, I checked it lots of times. I can start android from the 'tools' directory - do you know if I can point it to the directory in which the project resides? – user2447501 Jun 04 '13 at 13:17
  • To answer my own questions, yes, the syntax for using Android from the command line can be found here: http://developer.android.com/tools/projects/projects-cmdline.html - still not sure why the path variable doesn't work, but at least the updating was successful. Case closed, I think. – user2447501 Jun 04 '13 at 13:25
  • I am curious, if you type `echo %path%` on the command prompt, did you see `C:\Users\p\AppData\Local\Android\android-sdk\tools` anywhere in the response? – Joe Jun 04 '13 at 13:44
  • @user2447501 What was the problem? Can you make an answer, so we upvote it and mark the question as solved please? – verybadalloc Jun 04 '13 at 14:00
  • @Joe: Yes, it seems to be in the path, but for some reason I still get this error... – user2447501 Jun 04 '13 at 14:21
  • @verybadalloc: Sure, give me a minute. – user2447501 Jun 04 '13 at 14:21
  • Thank you for checking `echo %path%`, this is very strange indeed. Do you mind trying to type `C:\Users\p\AppData\Local\Android\android-sdk\tools\android.bat` and see what happens? And just to be sure, don't forget to use your actual user folder instead of `C:\Users\p`. – Joe Jun 04 '13 at 16:37
  • Thanks for your response, Joe. This actually seems to work (i.e. it opens the Android SDK Manager)... – user2447501 Jun 04 '13 at 16:58
  • I see, I am out of ideas then .. The last thing I would do is to copy android.bat to a different name (let's say daneel.bat) and see if you can call daneel.bat through the path instead :) – Joe Jun 05 '13 at 06:31
  • possible duplicate of [android' is not recognized as an internal or external command](http://stackoverflow.com/questions/11350692/android-is-not-recognized-as-an-internal-or-external-command) – wordsforthewise Jul 31 '15 at 02:03

4 Answers4

3

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 command console you executed the doskey command in. To make it permanent is more difficult: http://darkforge.blogspot.com/2010/08/permanent-windows-command-line-aliases.html

wordsforthewise
  • 13,746
  • 5
  • 87
  • 117
1

I do not know what causes the issue with the path variable.

However, the workaround I've used is to move to the "tools" directory and call android from there; I've added "--path " to point to the directory in which the project resides.

Details on how to manage android projects from the command line can be found here:

http://developer.android.com/tools/projects/projects-cmdline.html

user2447501
  • 53
  • 1
  • 1
  • 6
0

You might have installed Cygwin as part of the SDK. I had the same problem "android.bat is not recognized as an internal or external command". So, Uninstall the Cygwin and try again (you might not able to uninstall Cygwin, since a mysterious “permission denied” when deleting the Cygwin files by default). You need to own access to this mysterious Cygwin files by taking ownership:

takeown /r /d y /f cygwin (do this, wherever is your cygwin folder is)

This command takes ownership recursive of the folder, without asking anything and gives Full Access to Everyone recursively in the folder:

icacls cygwin /t /grant Everyone:F

And finally, the command which deletes it all and removes Cygwin:

rmdir /s /q cygwin

Good bye Cygwin! ;-)

Now try again. (This worked for me)

PS: You can always re-install cygwin again. So, nothing wrong giving it a try. Good Luck

Testing Singh
  • 1,347
  • 1
  • 15
  • 26
0
**Set the path in windows**

Control Panel\System and Security\System > advance system settings > environment variables

and update the path to include the following:enter code here

<android-root>\android-sdk-windows\tools

Use semicolons to separate paths in case yo have to add more path .