Compile Android program with ant

Source: Internet
Author: User

This article mainly involves creating Android projects, updating existing projects, and ant compilation projects.

I. Prepare ant

Download from ANT Official Website
Http://ant.apache.org/
Ant environment Configuration:
1. Decompress the ant package to the local directory.
2. Set ant_home in the environment variable to your installation directory.
3. Add ant_home/bin to the path of your system environment.

Ii. Use ant

1. First, check whether the environment change of the Android-SDK is added to the path. In this way, you can run the android command in any directory. Otherwise, you need to switch to the Android-SDK \ tools directory.

 

2. Use Android create to create a project

Parameter description:
-K/-- package: namespace (package name)-A/-- name Project Name
-P/-- path project-T indicates the version number of the Target Platform

C: \ Documents ents and Settings \ Administrator> Android Create Project-K com. Android. Ta
NK-a tank-T 4-p f: \ Tank

List the corresponding IDs of platforms of different versions. Android. Bat list targets/Android list
C: \ Documents ents and Settings \ Administrator> Android. Bat list targets

 

3. Android update updates existing projects

For an existing Android project, we can update it (modify the version of the platform) to automatically add ant configuration files such as build. xml.
C: \ Documents ents and Settings \ Administrator> Android update project -- name tank-T 11
-P f: \ Tank

 

4. Ant parameter Introduction

* Debug: Signature construction with debugging
* Release: Build an applicationProgramThe generated APK must be signed before it can be published.
* Install: Install and debug the build package to the running simulator or device;
* Reinstall
* Uninstall

When you use the ant command, you can enter the project directory, or ant debug buildfile: e: \ mylib \ Android \ androidant \ myboardcastreciver \ build. xml

 

/**
* @ Author Zhang xingye
* Email: xy-Zhang # 163.com
* Android development advanced group:278401545
*
*/

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.