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 local.properties when using release
#keystore
Key.store=xx.p12
Key.alias=xxx
Key.store.password=xxx
Key.alias.password=xxx
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://github.com/mentor811/Android-Batch-Pack
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://github.com/umeng/umeng-muti-channel-build-tool/tree/master/Gradle
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