C. Installing Apache Ant

The Android and BlackBerry development tools use Apache Ant to automate command-line build tasks. Ant is an open source project within the Apache Software Foundation’s suite of products. Ant is a Java-based build tool and therefore requires a Java Runtime Environment (JRE). Refer to Appendix B for instructions for installing the Java Developer Kit (JDK), which includes the JRE.

Macintosh Installation

For Macintosh users, Mac OS X includes a version of Ant preinstalled. You will need to verify that the version installed is compatible with the mobile development SDKs you will be working with (for example, at the time of this writing, the Android SDK requires version 1.8 and newer). To determine the installed version, open a terminal window, and issue the following command:

ant -version

Ant will respond with the currently installed version information, as shown in Figure C-1.

Image

Figure C-1 Verifying the Ant version on Macintosh

If a more recent version is needed, let the Macintosh OS software update process install its updates, and then try again. To perform a software update, open the System Preferences application, select Software Updates, and then click Check Now.

Windows Installation

To install Ant on a system running Microsoft Windows, point your browser of choice to http://ant.apache.org, and click the home page link to download the latest version of the project’s files. Once the download has completed, extract the files to a folder off of your system’s root folder. Figure C-2 shows an example of an Ant installation in Windows using the default zip file name (which includes the Ant version information) as the installation folder location.

Once the files have been extracted, you must update the Windows Path environment variable to point to the Ant installation’s bin folder. This allows Ant to be executed by any program on the computer such as the Android developer tools, without specifically pointing to the folder where Ant is installed. To modify the Path variable, open the Windows Control Panel and then select System or right-click My Computer and select Properties. In the System Properties application, click the Advanced System Settings tab, and then click the Environment Variables button on the bottom of the window. In the “System variables” area of the Environment Variables window, select Path, and then click the Edit button. In the window that appears, modify the variable value field by appending a semicolon at the end of the existing value and adding the full path to the Ant bin folder (C:apache-ant-1.8.2in, as shown in Figure C-2) to the end of the value that is already there. Do not replace the contents of the variable value field; simply append a semicolon and the Ant bin path to the end of the value that’s already there. Click OK repeatedly to close the windows that have been opened during this process. An example of this process is illustrated in Figure B-3 in Appendix B.

Image

Figure C-2 Ant installation bin folder in Windows

Once the process has completed, verify the successful installation and configuration by checking the Ant version using the instructions provided in the previous section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset