简体   繁体   English

无法将库添加到我的Android项目

[英]Can't add library to my android 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”,然后选中“ Is Library 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, Elad! 谢谢,埃拉德!

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. 而且符号链接库将不起作用。

For me, I just restart the eclipse and the added library works fine. 对我来说,我只需要重新启动Eclipse,添加的库就可以正常工作。

I mean first time it showing red marks after adding the library project. 我的意思是添加库项目后第一次显示红色标记。 Though eclipse main project and library project are in same workspace folder and no resources files are in outside of the project folder. 尽管eclipse主项目和库项目位于同一工作区文件夹中,但是资源文件不在项目文件夹之外。

So, you can try with to restart your eclipse. 因此,您可以尝试重新启动日食。 Happy coding.... 祝您编程愉快。

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

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