Android Ant and Gradle packaging process and efficiency comparison

Source: Internet
Author: User

One, ant packaging: (Download ant, configure the environment variable will not say)

1.go to command-line mode and switch to the project directory and execute the following command to add ant build support for the project created by ADT:

Android Update project-p. -T "ANDROID-17"

2.The build script default target is help, so it displays the information above, and modifying the target to debug or release can compile, build, and debug as if it were no ant. 3. Add signature information in when using release




4. Command line execution Build.xml:ant-buildfile Build.xml

5. Error handling
> BUILD failed> c:\android\android-sdk\tools\ant\build.xml:601:the following error occurred while executing this l Ine:> c:\android\android-sdk\tools\ant\build.xml:653:the following error occurred while executing this line:> c \ Android\android-sdk\tools\ant\build.xml:698:null returned:1

Also, if Eclipse is set to ' build automatically ' then this could keep popping up because eclipse would keep regenerating in to the Bin folder.
Just run 'ant clean release' instead of ' ant release ' is building this.
RM-FR $ (Find-type d-name Crunch|xargs)
Ant Clean Release
can refer to my project: Https://
Second, gradle packaging 1, downloadgradle 1.10 Configuring environment variables2. Configure the ANDROID environment variable android_home

3. Export the Build file

4. Modify the Build file

Reference: Https://

5. Implementation

gradle clean

gradle build

Third, Gradle and ant comparison 1, I used to feel gradle more harsh

A, androidmanifest.xml note must be < before and after!--must have space--

B, Chinese comments may be garbled

C, the MINSDK and TARGETSDK in each library project should be consistent with the main project

D, the format of PNG images is very strict

E, lint

When using ant, without encountering the above problems, the direct success.

2, Gradle will be the Library project Androidmanifest.xml merge into the main project, Ant will not 3, the flexibility is absolutely gradle, configure the Friends of the multi-channel, change package name configuration is OK, and ant is very laborious. 4, packaging efficiency comparison:

Items that were not build before the first execution

Gradle 2min pk Ant 2min 54 is the time to pack after a build has been executed:

Left Gradle right Ant

Related Article

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: 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.