如何引用外部JAR在Eclipse一个Android库项目 [英] How to reference an external jar in an Android Library project in Eclipse

查看:167
本文介绍了如何引用外部JAR在Eclipse一个Android库项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android的哦。我如何爱你的空话。

Oh Android. How I love your verbiage.

我有几个项目中有一个工作区。 APP1和App2的是Android应用程序。常见的是一个Android库项目。 APP1和App2的依赖于通用(通过Android标签链接)。

I have a workspace with a few projects in it. App1 and App2 are Android applications. Common is an Android library project. App1 and App2 depend upon Common (linked via the Android tab).

常见的有一些外部的依赖关系,即httpmime和放大器; Apache的mime4j,这是jar文件存在。

Common has some external dependencies, namely httpmime & apache-mime4j, which exist as jar files.

由于某些原因,看来,我需要我的哑剧罐子添加到程序App1和App2的的时候才能成功编译构建路径。这似乎是非常愚蠢的。在正常的Java,我想补充通用于程序App1和App2的,事情的构建路径会的工作。这是预期的,我有我的罐子添加到每个Android应用程序?

For some reason, it appears that I need to add my mime jars to the build path of App1 and App2 for compilation to succeed. This seems really dumb. In normal Java, I would add Common to the build path of App1 and App2 and things would work. Is this expected that I have to add my jars to every Android application?

-Andy

请注意:如果我不配置如上文所述,我得到类型org.apache.james.mime4j.message.SingleBody解决不了的构建路径它是间接地从必需的.class文件中引用| DataCallUtil。 java的| /程序App1 /通用/ UTIL | 364行

Note: If I don't configure the build path as described above, I get "The type org.apache.james.mime4j.message.SingleBody cannot be resolved. It is indirectly referenced from required .class files | DataCallUtil.java | /App1/Common/util | line 364"

推荐答案

我觉得omermuhammed和艾米特没有得到的事实,维瑟正在谈论的是Android库项目。 对于这些项目,我不认为这是可能创造一个罐子。 (JAR无​​关与所有的Andr​​oid资源的事情)。

I think omermuhammed and Amit didn't get the fact that Visser is talking about a Android Library Project. For those project, I don't think it is possible to create a jar. ( jar has nothing to do with all the Android resources thing ).

从我的经验与Android库项目,这种项目是公正的,基本上,源和ressources包装,并准备好被包含在其他项目中。 但设置不包的一部分,所以你必须包含库为每个应用程序。 根据我的经验,这个设置是不是经常发生变化,所以它并没有那么糟糕。

From my experience with Android Library Project, this kind of project are just, basically, the sources and the ressources packaged, and ready to be included in another project. But the settings are not part of the package, so you have to include the libs for each application. In my experience, this setting is not something that changes often, so it is not so bad.

Android的图书​​馆计划依然被完美的方式,但还是从那儿有什么巨大的改善之前(即无)。

Android Library Project are still way from being perfect, but still a huge improvement from what was there before ( ie nothing ).

这篇关于如何引用外部JAR在Eclipse一个Android库项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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