Ant Usage Summary (i): auto-pack apk with Ant

Source: Internet
Author: User

Configuring the ANT Environment


(1) Download ant

One: Http://mirrors.cnnic.cn/apache//ant/binaries/apache-ant-1.9.4-bin.zip

Two: http://pan.baidu.com/s/1gdnc98n

(2) Unzip Ant and configure the Bin directory path to the system path variable


The ability to execute an ant command in a command-line window indicates a successful configuration



Update Engineering Configuration


(1) Open a command line window and execute the following command:

SDK Root \tools\android Update Project--name project name--target compile using the Android SDK version--path project path

Example:

D:\AndroidDeveloper\adt-bundle-windows-x86_64-20140321\sdk\tools\android Update Project--name Linchaolong--target Android-10--path E:\Project\Linchaolong


The list of SDK versions can be listed using the Android list target command.


(2) After successful execution, the following files are generated in the project catalog:

Ant.properties

Build.xml

Local.properties

Proguard-project.txt


Note: If the project is dependent on other projects, then the dependent projects will also need to have these files, you can also use this command to generate.


Related configuration


(1) Configure. keystore file related information in the Ant.properties file

Key.store=.keystore file path
Key.store.password=.keystore file Password
key.alias.password= the password for the alias
key.alias= aliases
#java代码混淆配置文件

Proguard.config=proguard-project.txt


(2) using the ant command to generate APK

Optional Parameters:

Debug: Build with a debug signature
Release: Build the app, the generated apk must be signed before it can be published
Install: Installs and debugs the built-in package to the running simulator or device;

For example, ant release indicates that the generated signature apk,apk is generated in the Project Bin directory.


Error logging


Error: [AAPT] Invalid resource directory Name:xxx/bin/res/crunch

WORKAROUND: Delete the Crunch folder and click on the project--project--cancel build automatically to resolve it.


Reference article address: http://blog.csdn.net/androiddevelop/article/details/11553215


Related articles:

Ant Usage Summary (ii): Related command description

Ant Usage Summary (iii): bulk pack apk

Ant Usage Summary (i): auto-pack apk with Ant

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.