一、下载ANT
ant 官网可下载 http://ant.apache.org/
ant 环境配置:1。解压ant的包到本地目录。
2。在系统环境变量中设置ANT_HOME,值为你的安装目录。
3。把ANT_HOME/bin加到你系统环境的path
4.可能需要重启系统,执行一下,ant -version
二、详细使用
1.生成一个android project
用eclipse或者android命令都行
2.
对已经存在的android工程,我们可以update下,这样会自动添加build.xml 等ant 的配置文件
C:\Documents and Settings\Administrator>android update project --target android-17 --path E:\work\android_workspace\HaifeiAccumulation
可以自己查一下帮助文档android update project -h
3.
3.1执行C:\Documents and Settings\Administrator>ant debug 生成debug apk。这里签名用的是系统的
3.2执行 C:\Documents and Settings\Administrator>ant release 生成release apk。这样生成的apk是没有签名的
配置文件ant.properties:
a.在本地工程下生成一个文件ant.properties
b.内容为
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
# location of the SDK. This is only used by Ant
# For customization when using a Version Control System, please read the
# header note
key.store=签名文件
key.alias=签名的alias
key.alias.password=密码
key.store.password=密码
具体签名相关的东西网上自己看一下
4
再次执行 C:\Documents and Settings\Administrator>ant release 看一下你的工程目录下的bin目录是不是多了MainActivity-release.apk