Skip to content

Commit

Permalink
Update Ant打包.md
Browse files Browse the repository at this point in the history
  • Loading branch information
CharonChui committed Jan 13, 2014
1 parent 0b72926 commit 44f5c67
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions Ant打包.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@ Ant打包
===

使用步骤:

1. 对于已经存在的工程需要利用`Ant`命令更新一下:

```
android update project -n Test -p D:/workspace/Test -s -t 1
```
  -n (name) 后面跟的是这个工程的名子
  -p (path)后面跟的是这个工程的目录路径
  -t (target)后面是当前共有的`SDK`版本。表明我们的*目标版本*(如果有了`project.properties`就不用再跟target这个参数了).
  android list target这样就能够列出来所有的sdk版本

2. 将签名文件keystore复制到工程根目录下,并且在根目录下新建`ant.properties`内容如下(配置签名文件):

```
  key.store=keystore.keystore //把签名放到根目录中
  key.alias=tencent
Expand All @@ -21,14 +25,16 @@ Ant打包
3. 刷新工程,然后在`eclipse`中的`Ant`视图中右键`add build files`选择工程中的`build.xml`,选择最下面的release或者是debug,注意release是生成带签名的apk包.生成的apk在bin目录中,名字为工程名-release.apk.

4. 常见错误:
有时候在用ant打包的时候会报一些错误,一般按照错误的提示进行修改即可,如文件的非法字符等。
```java
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
```
如果发现以上错误,就是说明栈内存不足了,一种是内存设置的太小,还有一种情况就是你设置的内存大小已经超过了当前系统限制的大小。打开`D:\Java\adt-bundle-windows\sdk\build-tools\android-4.4\dx.bat`将`set defaultXmx=-Xmx1024M`改为`set defaultXmx=-Xmx512M`即可。
有时候在用ant打包的时候会报一些错误,一般按照错误的提示进行修改即可,如文件的非法字符等。
```java
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
```
如果发现以上错误,就是说明栈内存不足了,一种是内存设置的太小,还有一种情况就是你设置的内存大小已经超过了当前系统限制的大小。打开`D:\Java\adt-bundle-windows\sdk\build-tools\android-4.4\dx.bat`将`set defaultXmx=-Xmx1024M`改为`set defaultXmx=-Xmx512M`即可。


---

- 邮箱 :charon.chui@gmail.com
Expand Down

0 comments on commit 44f5c67

Please sign in to comment.