添加的Andr​​oid库项目到Eclipse构建路径? [英] Adding Android library project to Eclipse build path?

查看:203
本文介绍了添加的Andr​​oid库项目到Eclipse构建路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个多模块的Andr​​oid Maven项目其中包括几个项目,一个Android库项目(baselib)在我运行非基于Android的JUnit测试。

I have a multi module Android Maven project which consists of several projects and an Android library project (baselib) where I run non Android based JUnit tests.

这个工作,只要运行测试通过的Maven。当我运行baselib JUnit测试用的Eclipse运行 - >作为JUnit测试,我没有获得最新的版本。这意味着,改变JUnit测试都没有效果,直到我做一个Maven构建。

This works as long as I run the test by Maven. When I run the baselib JUnit tests by Eclipse with Run->As JUnit test, I don't get the current version. That means that changes in the JUnit test have no effect until I make a Maven build.

我想过加入bin文件夹到Eclipse构建路径,但我得到在Eclipse中的错误信息:

I thought about adding the bin folder to the Eclipse build path, but I get an error message in Eclipse:

里面能不能嵌套的输出文件夹... baselib-TRUNK /斌/班   ... baselib-TRUNK /箱

Cannot nest output folder ...baselib-TRUNK/bin/classes inside ...baselib-TRUNK/bin

这是莫名其妙地清晰。因此,我认为有关将罐子本身的构建路径。我说这一次作为外部JAR,那么一旦作为罐子。但我仍然没有得到$ C $的当前版本℃,但罐子的时间戳记当前版本,如果我修改并保存一些code。 (自动构建在Eclipse中选中)。输出文件夹由Eclipse的构建路径配置,这是在pom.xml中设置... /斌/类认可。我也尝试添加 /斌/测试类以构建包含测试类的路径,但仍是code无新版本。

That's somehow clear. So I thought about adding the jar itself to the build path. I added it once as external jar, then once as jar. But I still don't get the current version of the code although the timestamp of the jar has the current version if I modify and save some code. (Build Automatically is checked in Eclipse). Output folder is recognized by Eclipse's build path configuration as .../bin/classes which is set in pom.xml. I also tried to add /bin/test-classes to build path which contains the test class itself, but still no new version of the code.

为什么这不是工作,获得最新的版本,我怎么能解决这个问题?

Why does this not work to get the current version and how can I solve this?

推荐答案

由于库项目都在同一个工作区,我们就可以直接引用该项目。打开preferences为您的项目,然后点击Android的部分。

Since the library projects are in the same workspace, we can reference the project directly. Open the preferences for your project and click on the "Android" section.

现在,您将看到引用库项目的窗口。

Now, you will see a window for referencing library projects.

点击添加...按钮,选择您想要的项目,点击确定,然后点击应用。 只有被标记为库项目可以被选择并且以这种方式被引用。如果你的项目没有出现,打开他们的preferences并在他们的preferences的窗口选中是库复选框。

Click the "Add..." button, select the projects you want, click "OK", and hit "Apply". Only projects that are marked as libraries can be selected and referenced in this manner. If your projects are not appearing, open their preferences and mark the "Is Library" box in this window of their preferences.

您的项目现在引用这些库,包括你做的所有更改。这比用一个罐子,如果你的库将有所变化,更好。否则,你就必须删除,并在每次做出改变时重新添加罐。

Your project will now reference these libraries, including any changes you make to them. This is better than using a jar if your libraries will be subject to change. Otherwise, you would have to remove and re-add the jar every time you make a change.

这篇关于添加的Andr​​oid库项目到Eclipse构建路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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