Android Ant packaging notes

Source: Internet
Author: User

 

 

Android Ant package

It seems too complicated to find the ant package on the Internet. In fact, android has done a good job for us. Besides multi-channel packaging

 

1. Notes

There are several directories in this article.

SDK directory. This article is in F: android-sdk-windows

Ant directory. This article is in E: apache-ant-1.9.2

Code path, pointing to the directory of your code, that is, the project directory in the workspace, such as D: workspaceAndroidApp

2. Configure ant

Download ant

Http://ant.apache.org/

After downloading, decompress the package to the edisk, or decompress the package to another disk. If you decompress the package to E: apache-ant-1.9.2, the directory structure is as follows:

 

Configure environment variables and create a new one in user Variables

 

Add the following code at the end of the new PATH.

% ANT_HOME % in;

Run cmd

 

Ant has been configured successfully.

 

3. Generate build. xml

Run cmd to enter the sdk directory F: android-sdk-windows ools, for example:

 

In the figure, change the project path to your own path.

The following two files are generated in your project path:

 

The two files can be modified without modification.

Create ant. properties in this directory.

The content is as follows:

Key. store = Signature File

Key. alias = signature alias

Key. store. password = signature password

Key. alias. password = alias password

Save

Run Cmd to enter this directory and execute the ant command

Ant debug

In this way, two files will be generated, one unsigned apk and the apk file signed with debug. (Generated under the bin directory)

Ant release

Only one unsigned apk file is generated for package in release format, but it is confusing. (The premise of obfuscation is that your project has been added with proguard obfuscation ).

4. Possible Problems

If the following error occurs when running ant:

BUILD FAILED

F: android-sdk-windows oolsantuild. xml: 653: The following error occurred while executing this line:

F: android-sdk-windows oolsantuild. xml: 698: null returned: 1

The solution is to clear all the files in the bin directory. If you clean the current project in eclipse

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.