This is my first time developing Android applications. I'm developing an Android app on Eclipse on Windows 7. I would like to run the Android app from the Windows 7 command line interface. I have my Android device connected to the PC.

The workspace directory that I use to store the Android project is

C:\Users\Guest\Desktop\Software Applications Development\Java\Android Moblie Applications Projects\Eclipse Indigo for Java EE x64-bit\project workspace

I opened the command line interface and I changed the working directory to the Android workspace directory.

cd C:\Users\Guest\Desktop\Software Applications Development\Java\Android Moblie Applications Projects\Eclipse Indigo for Java EE x64-bit\project workspace

I included Android sdk platform tools directory into the PATH environment variable.


Then I entered this into the Windows 7 command line interface:

ant debug

I have this error message on the cmd:

ant is not recognised as an internal or external command, operatable program or batch file.

What is the solution to this problem?

  • 1
    If you cd to ...\android-sdks\platform-tools does the command work? In other words, is ant in that directory?
    – iglvzx
    Jun 17 '12 at 6:39
  • Are there any typos, i.e. did you separated ....\platform-tools with a semicolon?
    – harper
    Jun 17 '12 at 7:20
  • There was no mistake Jun 18 '12 at 15:05

ant is not a part of standard Android SDK setup. You'll have to install it.

  • Download the latest ant zip file from The Apache Ant Project.
  • Extract the zip file to a folder, say c:\ant\
  • Add c:\ant to your path environment variable

Once these are done, you'll be able to run ant from the command line

  • I still cant run ant despite downloading, extract an to folder and add to path environment variable. The windows that i ran on was 64-bit version. the android sdk supports 32-bit java jdk but not the 64 bit java jdk Jun 18 '12 at 14:55
  • by the way my workspace is located in the windows 7 guest account. I accessed the android workspace using the windows 7 administrator account. Jun 18 '12 at 14:57
  • @user1294663 the SDK supports 64-bit JDK ( I use the 64-bit JDK, fyi).
    – Sathyajith Bhat
    Jun 18 '12 at 14:59
  • The android windows installer cannot proceed on to install the android sdk when i only installed the java 64-bit jdk version for windows 7 64-bit. When the android windows installer detects the 32-bit version of java jdk the android sdk can be installed. That was what i encountered. Jun 18 '12 at 15:01
  • 1
    I think i managed to run ant. i put the environment variable for apache ant directory with \bin. Then i ran ant debug . Now i see a different message . It says unable to locate tools.jar Expected to find it in C:\Program Files\ Java\jre7\lib\tools.jar Buildfile: build.xml does not exist build failed. Now what??? Jun 19 '12 at 13:49

To assist with the above. verify from your Java installation directory that You have tools.jar; if not go and download http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html . after installation, you should see tools.jar in the lib subdirectory(i.e path_to_installation/java/jdkx.x.x/lib). After that; you need to add the path to this new installation with : variable_name: JAVA_HOME and variable_value= path_to_installation/java/jdkx.x.x

Ant should not give you the JDK error again. If you already have the tools.jar, then just add the JAVA_HOME to point to the directory as mentioned above "path_to_installation/java/jdkx.x.x"-this assumes that tools.jar is some where in the jdkx.x.x directory You may encounter issues with build.xml, check out this link: http://www.vogella.com/articles/AndroidBuildAnt/article.html

Note: x.x.x represents the version Number of your installation

  • 1
    I think that should be JAVA_HOME, not JAV_HOME.
    – BruceHill
    Feb 12 '13 at 23:24

Navigate to the .android folder in your home directory ~/.android (Linux,Mac OS) or C:\Documents and Settings[User Name].android in Windows XP or C:\Users.android in Windows Vista or Windows 7, and delete the debug.keystore file. Then go to eclipse and clean the project, this will create a new debug.keystore file with default validity period 365 days.

For Linux user: Delete your debug certificate (debug.keystore and ddms.cfg) under ~/.android/debug.keystore

For Windows user: Delete your debug certificate (debug.keystore and ddms.cfg) under C:\Documents and Settings\Administrator.android


First, you have to download ANT. Here is the link https://ant.apache.org/bindownload.cgi.

Then extract your downloaded file in C:\Program Files\Ant Folder where Ant Folder is the folder name where I have extracted.

Now you have to set environment variables.
Right click on This PC > Properties > Advanced system settings > Environment Variables > User variables > New > Variable name:ANT_HOME & for Variable value:C:\Program Files\Ant Files\apache-ant-1.10.5 > OK.

Now goto System variables to add bin path.
System variables > double click on Path >New > C:\Program Files\Ant Files\apache-ant-1.10.5\bin > OK.

Now let's check whether it is installed correctly or not.
goto Command Prompt > and type ant -version.
That's it. Let me know if still getting any difficulties.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.