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 Local.properties when using release
#keystore
Key.store=xx.p12
Key.alias=xxx
Key.store.password=xxx
Key.alias.password=xxx
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://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
4. Modify the Build file
Reference: Https://github.com/umeng/umeng-muti-channel-build-tool/tree/master/Gradle
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