Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

c:\Users\admin\Android-sdks\platform-tools

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?

share|improve this question
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 –  user1294663 Jun 18 '12 at 15:05

3 Answers 3

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

share|improve this answer
    
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 –  user1294663 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. –  user1294663 Jun 18 '12 at 14:57
    
@user1294663 the SDK supports 64-bit JDK ( I use the 64-bit JDK, fyi). –  Sathya 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. –  user1294663 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??? –  user1294663 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

share|improve this answer
    
I think that should be JAVA_HOME, not JAV_HOME. –  BruceHill Feb 12 '13 at 23:24
    
Yes, thanks... Updated accordingly. –  I L Feb 14 '13 at 21:08

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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