简体   繁体   English

无法将库项目添加到我的应用程序项目中?

[英]Can't add library project to my app project?

I'm creating a new app and I want to use some libraries like this: https://github.com/JakeWharton/Android-ViewPagerIndicator 我正在创建一个新应用,我想使用一些像这样的库: https : //github.com/JakeWharton/Android-ViewPagerIndicator

I had downloaded this library, added it to my workspace using New Android Project -> Create from existig source. 我已经下载了该库,并使用New Android Project->从existig源创建将其添加到我的工作区中。 Went to properties > android, and checked Is Library. 转到“属性”>“ android”,然后选中“是库”。 Then I went to properties > android in my app project, and clicked add on the Libraries section, and chose the library, and It show me the library with a green V near it. 然后,在我的应用程序项目中转到“属性”>“ android”,然后单击“库”部分中的“添加”,然后选择库,它向我显示了一个带有绿色V的库。 I've clicked ok, but couldn't use the library so I've opened the properties > android again, and there was a red cross near the library, and '?' 我单击确定,但无法使用该库,因此再次打开了属性> android,并且该库附近有一个红叉,并且显示“?” under the "Project" column. 在“项目”列下。

I can't understand why it's happening! 我不明白为什么会这样! It's really annoying, happened to me when I tried to add facebook API to my app, and I just gave up and copied the source to my project. 真烦人,当我尝试将Facebook API添加到我的应用程序时发生了,我只是放弃了并将源复制到我的项目中。

Thanks 谢谢

You have to copy every Library manually inside Eclipse Workspace, before importing it, as Eclipse seems to be silly if the Library lays somewhere else. 在导入之前,您必须在Eclipse Workspace中手动复制每个库,因为如果库位于其他位置,则Eclipse看起来很愚蠢。 Also symlinking a Library will not work. 而且符号链接库将不起作用。

The solution for me was to Delete the library project from Eclipse (but not from disk of course), and Import it again (Import existing Android Code into Eclipse). 对我来说,解决方案是从Eclipse(当然不是从磁盘)删除库项目,然后再次导入(将现有的Android代码导入Eclipse)。 The problem disappeared then. 然后问题消失了。

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

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