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 folder. Run the following command to add ant build support for an ADT-created project:

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

2.the build script default target is help. So the message is displayed, and changing the target to debug or release will be able to compile, build, and debug as if it were ant-free. 3. Add signature information to when using release




4, command line run 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
Be able to test 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

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvbwfzb25ibg9n/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">

4. Change the Build file

References: Https://

5. Operation

gradle clean

gradle build

Three, Gradle and ant comparison 1, I used to feel gradle than harsh

A, androidmanifest.xml in the gaze must <!--before and after the need to have space--

B, Chinese gaze 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

And 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 the name of the package configuration is OK. And Ant is very laborious. 4, Packaging efficiency control:

Projects that did not build before the first run

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

Left Gradle right Ant

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvbwfzb25ibg9n/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">

Android Ant and Gradle packaging process and efficiency comparison

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.