简体   繁体   English

如何处理引用的库项目使用的库?

[英]How to handle libraries used by a referenced library project?

I installed a bunch of updates via Android SDK Manager this morning including Android SDK Tools 22.0.1. 我今天早上通过Android SDK Manager安装了很多更新,包括Android SDK Tools 22.0.1。 This has seemed to be disastrous so far. 到目前为止,这似乎是灾难性的。 One disaster is handling libraries. 一种灾难是处理库。 Here is the scenario: 这是场景:

I have a project projFoo that uses a library project libFoo. 我有一个使用图书馆项目libFoo的项目projFoo。 libFoo uses a dozen or so libraries or projects. libFoo使用了十几个库或项目。 In other words, libFoo has the following in its Java Build Path: projA, projB, projC,... lib1.jar, lib2.jar, lib3.jar ... 换句话说,libFoo在其Java构建路径中具有以下内容:projA,projB,projC,... lib1.jar,lib2.jar,lib3.jar ...

I used to need only adding libFoo to the build path of projFoo, and everything was working fine until I installed the updates. 我以前只需要将libFoo添加到projFoo的构建路径中,并且在安装更新之前一切工作都很好。

After the updates, I have been adding projA, projB, lib1.jar one by one to projFoo's build path even though projFoo does not use them directly. 更新后,即使projFoo不直接使用它们,我也一直在projFoo的构建路径中逐一添加projA,projB,lib1.jar。 Without doing this, java.lang.NoClassDefFoundError would occur when I run the app. 如果不执行此操作,则在运行应用程序时会发生java.lang.NoClassDefFoundError。

I have cleaned all projects and restarted Eclipse many times. 我已经清理了所有项目,并多次重启了Eclipse。 I also checked those referenced projects and libraries in Order and Export of libFoo, but adding those references still seems to be necessary. 我还在libFoo的Order and Export中检查了那些引用的项目和库,但是添加这些引用似乎仍然是必要的。 Is this the right way to handle this? 这是处理此问题的正确方法吗?

In the order and export tab of Java Build Path make sure Android private Libraries and Android Dependencies are checked. 在“ Java构建路径”的“顺序和导出”选项卡中,确保已选中“ Android私有库”和“ Android依赖关系”。

Any libraries in .jar format should just go in the libs folder of your project. 任何.jar格式的库都应该放在项目的libs文件夹中。 There's no need to add them to the build path. 无需将它们添加到构建路径。

Any libraries that are a project can just be added to the Java Build Path Projects tab, or if it is an android project, you can add it to the Library section under the Android pane. 任何作为项目的库都可以直接添加到“ Java Build Path Projects”选项卡,或者如果它是android项目,则可以将其添加到“ Android”窗格下的“库”部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM