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