Download Ant from its website at http://ant.apache.org/bindownload.cgi and unzip its binary package in the directory of your choice (for example, C:Ant).
After installation, define JDK, Cygwin, and Ant locations in environment variables. To do so, open Windows Control Panel and go to the System panel (or right-click on the Computer item in the Windows Start menu and select Properties).
Then, go to Advanced system settings. The System Properties window appears. Finally, select the Advanced tab and click on the Environment Variables button.
In the Environment Variables window, inside the System variables list, add:
The CYGWIN_HOME variable with the Cygwin installation directory as the value (for example, C:Cygwin)
The JAVA_HOME variable with the JDK installation directory as the value
The ANT_HOME variable with the Ant installation directory as the value (for example, C:Ant)
Prepend %CYGWIN_HOME%in;%JAVA_HOME%in;%ANT_HOME%in;, all separated by a semicolon, at the beginning of your PATH environment variable.
Finally, launch a Cygwin terminal. Your profile files get created on the first launch. Check the make version to ensure Cygwin works:
make –version
You will see the following output:
Ensure JDK is properly installed by running Java and checking its version. Check carefully to make sure the version number corresponds to the newly installed JDK:
java –version
You will see the following output on the screen:
From a classic Windows terminal, check the Ant version to make sure it is properly working:
ant -version
You will see the following on the terminal:
What just happened?
Windows is now set up with all the necessary packages to host Android development tools:
Cygwin, which is an open source software collection, allows the Windows platform to emulate a Unix-like environment. It aims at natively integrating software based on the POSIX standard (such as Unix, Linux, and so on) into Windows. It can be considered as an intermediate layer between applications originated from Unix/Linux (but natively recompiled on Windows) and the Windows OS itself. Cygwin includes Make, which is required by the Android NDK compilation system to build native code.
Tip
Even if Android NDK R7 introduced native Windows binaries, which does not require a Cygwin runtime, it is still recommended to install the latter for debugging purpose.
A JDK 7, which contains the runtime and tools necessary to build Java applications on Android and run the Eclipse IDE as well as Ant. The only real trouble that you may encounter when installing a JDK is some interferences from a previous installation, such as an existing Java Runtime Environment (JRE). Proper JDK use can be enforced through the JAVA_HOME and PATH environment variables.
Tip
Defining the JAVA_HOME environment variable is not required. However, JAVA_HOME is a popular convention among Java applications, Ant being one of them. It first looks for the java command in JAVA_HOME (if defined) before looking in PATH. If you install an up-to-date JDK in another location later on, do not forget to update JAVA_HOME.
Ant, which is a Java-based build automation utility. Although not a requirement, it allows building Android applications from the command line, as we will see in Chapter 2, Starting a Native Android Project. It is also a good solution to set up a continuous integration chain.
The next step consists of setting up the Android development kits.
Installing Android development kits on Windows
Android requires specific development kits to develop applications: the Android SDK and NDK. Hopefully, Google has thought about the developer community and provides all the necessary tools for free.
In the following part, we will install these kits to start developing native Android applications on Windows 7.