Windows, ant automation compiles Android project specific steps and methods

Source: Internet
Author: User



Note: if Android project references have third-party libraries, and procedures and methods are also applicable.

The premise is that ant is already installed.

1 , you first need to create a batch command (*.bat) file:Ant for Android.bat, which writes the following command in the file:

Set path=c:\windows\system32;d:\java\jdk\bin;d:\ant\apache-ant-1.9.3\bin;d:\android\adt-bundle-windows-x86_ 64-20130522\sdk\tools;start     "Ant for Android" CLS

There are a number of standalone Android projects in the 2,eclipse workspace directory, and assuming a project called Xxxdemo, you need to place Ant for Android.bat on the Xxxdemo level directory. Then execute the following command:

Android Update Project-p Xxxdemo


At this point, in the Xxxdemo directory, a number of files, this is the Android SDK automatically generated files, such as one of the Build.xml (this file is important).
If the project refers to a third-party library, execute the above command one by one, the only difference is to modify the project name, Android update Project-p XX, such as:
Android Update Project-p Library


3. Enter the Xxxdemo directory and place the ant for Android.bat in the Xxxdemo directory:

Depending on the configuration properties provided by Ant.properties at the time of subsequent ant Automation compilation, the signature KeyStore used in the Android project is the official release of the app.

Put the x.keystore into the Xxxdemo root directory:
Create the Ant.properties file and write the following in the Ant.properties file:


has.keystore=truehas.password=truekey.store=x.keystorekey.alias= keystore name you named key.store.password= The password you set key.alias.password= the password you set


4, and then double-click the ant for Android.bat file to execute the command:
Ant Release
Can. Generate the official release signature apk in the bin directory.


Summarize:
Use the Android SDK to generate Build.xml files automatically (Android update project-p Xxxdemo);
Then put the signed KeyStore into the Xxxdemo project root directory, while creating a ant.properties file stating the user name and password;
Finally, execute ant release.


Note: After you execute the ant release command, if you reference a third-party library at auto-compile time, there may be some problems that can be resolved by clearing all third-party libraries and all files in the bin directory in this project and re-executing them.

Windows, ant automation compiles Android project specific steps and methods

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.