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