如何通过命令行外部JAR库添加到Android项目 [英] How to add external jar libraries to an android project from the command line

查看:155
本文介绍了如何通过命令行外部JAR库添加到Android项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个有一定相关性的Andr​​oid项目。 JAR文件中的lib /目录下。我可以通过添加这些jar文件到类路径中生成项目,当然在仿真器是强制关闭,因为这些库不是present。

I'm trying to build an Android project that has some dependencies. The jar files are in the lib/ directory. I can build the project by adding those jar file to my classpath, but of course it Force Closes in the emulator because those libraries aren't present.

我这样做是在命令行中使用Ant(不可以在eclipse)。我怎样才能使包括图书馆命令行的APK?

I'm doing this from the command line with ant (not in eclipse). How can I make it include those libraries in the apk from the command line?

推荐答案

周杰伦K公司的答案是正确的,在写作的时候,但现在的SDK已经改变,这里是新的方式来做到这一点:

Jay K's answer was right at the time of writing, but now the SDK has changed, and here is the new way to do it:

添加以下行 ant.properties

jar.libs.dir=lib

经测试,工作的地方external.libs.dir不起作用。
这改变 2010年12月,然后又在2011年10月。

Tested, works where external.libs.dir does not work.
That changed in December 2010 and then again in October 2011.

这篇关于如何通过命令行外部JAR库添加到Android项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆