Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> 關於Android編程 >> Android Ant 和 Gradle 打包流程和效率對比

Android Ant 和 Gradle 打包流程和效率對比

編輯:關於Android編程

一、Ant 打包:(下載ant、配置環境變量就不說了)

1、進入命令行模式,並切換到項目目錄,執行如下命令為ADT創建的項目添加ant build支持:

android update project -p . -t "android-17"

2、build腳本默認target是help,所以會顯示如上信息,修改target為debug或release就可以像無ant時一樣編譯、生成以及調試了。

3、使用release時 在local.properties添加簽名信息

#keystore

key.store=xx.p12

key.alias=xxx

key.store.password=xxx

key.alias.password=xxx

4、命令行執行build.xml: ant -buildfile build.xml


5、error 處理

> BUILD FAILED
> C:\Android\android-sdk\tools\ant\build.xml:601: The following error occurred while executing this line:
> 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 will keep regenerating into the bin folder.
just run 'ant clean release' instead of 'ant release' when you are building this.
rm -fR $(find . -type d -name crunch|xargs)
如果遇到上述error 就執行 ant clean release
可以參考我的項目:https://github.com/mentor811/Android-Batch-Pack

二、gradle 打包

1、下載gradle 1.10 配置環境變量

2、配置android 環境變量 ANDROID_HOME

3、導出build文件

\


<喎?/kf/ware/vc/" target="_blank" class="keylink">vcD4KPGgyPjShotDeuMRidWlsZM7EvP48L2gyPgo8cD6yzr+8o7podHRwczovL2dpdGh1Yi5jb20vdW1lbmcvdW1lbmctbXV0aS1jaGFubmVsLWJ1aWxkLXRvb2wvdHJlZS9tYXN0ZXIvR3JhZGxlPC9wPgo8aDI+NaGi1rTQ0DwvaDI+CjxwPjwvcD4KPHA+Cjxjb2RlPmdyYWRsZSBjbGVhbjwvY29kZT48L3A+CjxwPgo8Y29kZT5ncmFkbGUgYnVpbGQ8L2NvZGU+PC9wPgo8YnI+CjxoMT7I/aGiZ3JhZGxlILrNIGFudCC1xLHIvc88L2gxPgo8aDI+MaGisb7Iy9PDxvDAtLjQvvUgZ3JhZGxlILHIvc+/wb/MPC9oMj4KPHA+YaGiQW5kcm9pZE1hbmlmZXN0LnhtbMDvtcTXosrNsdjQ6zwhLS0gx7C687HY0OvSqtPQv9UmIzI2Njg0OyAtLT48L3A+CjxwPmKhotbQzsTXosrNv8nE3Lvh09DC0sLrPC9wPgo8cD5joaK497j2bGlicmFyeSBwcm9qZWN0IMDvtcQgbWluc2RrILrNdGFyZ2V0c2RrINKqus3W97mks8yxo7PW0rvWwjwvcD4KPHA+ZKGittRwbmcgzbzGrLXEJiMyNjY4NDvKvbrc0c8mIzI2Njg0OzwvcD4KPHA+ZaGibGludDwvcD4KPHA+tvggIMq508NBbnQgyrGjrMO709DT9rW9yc/K9s7KzOKjrNaxvdO+zbPJuabBy6GjPC9wPgo8aDI+MqGiZ3JhZGxlILvhsNFsaWJyYXJ5IHByb2plY3QgwO9BbmRyb2lkbWFuaWZlc3QueG1sILrPsqK1vdb3uaSzzKOsYW50sru74TwvaDI+CjxoMj4zoaLB6bvu0NTJzyC++LbUysdncmFkbGWjrMXk1sPT0cPLtuDH/rXAoaK4xLD8w/sgxeTWw9K7z8K+zW9ro6y2+GFudLrct9G+oqGjPC9oMj4KPGgyPjShorTysPzQp8LKttSxyKO6PC9oMj4KPHA+PC9wPgo8cD4KtdrSu7TO1rTQ0MqxINaux7DDu9PQYnVpbGS1xLXEz+7EvyA8L3A+CmdyYWRsZSAybWluICAgNTMgICBwayAgICBhbnQgIDJtaW4gNTQKz8LNvMrHINLRvq3WtNDQuf3Su7j2YnVpbGS687XEtPKw/MqxvOQ6Cgo8cD7X87HfZ3JhZGxlICDT0rHfIGFudDwvcD4KPHA+PGltZyBzcmM9"/uploadfile/Collfiles/20140518/201405180927558.jpg" alt="">




  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved