Eclipse 不会将项目识别为库 (ActionBarSherlock/ViewPagerIndicator)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10200751/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 18:02:47  来源:igfitidea点击:

Eclipse will not recognize project as library (ActionBarSherlock/ViewPagerIndicator)

androideclipseactionbarsherlockandroid-viewpagerandroid-library

提问by TJ Biddle

I'm trying to get ActionBarSherlockand the ViewPagerIndicatorlibraries set up for my projects, but I seem to be running into a few issues. I sent Jake Wharton (The developer) a few messages earlier about it, and got a few replies but couldn't get anywhere - and I think he got busy with a few other things.

我正在尝试为我的项目设置ActionBarSherlockViewPagerIndicator库,但我似乎遇到了一些问题。我早些时候向 Jake Wharton(开发人员)发送了几条关于它的消息,并收到了一些回复,但无济于事 - 我认为他忙于其他一些事情。

What my issue is, For both VPI and ABS For both VPI and ABS

我的问题是,对于 VPI 和 ABS 对于 VPI 和 ABS

Both libraries open up without any errors, and I'm using compiler version 1.6 for all as is required.

两个库都打开时没有任何错误,我根据需要使用编译器版本 1.6。

The funny thing is, if I load in the samples that are provided - they work fine and link to his library; but when I go to add the library to my project - the above happens.

有趣的是,如果我加载提供的样本 - 它们工作正常并链接到他的图书馆;但是当我将库添加到我的项目时 - 发生了上述情况。

回答by yorkw

Where to store the actual library project does not matter, as long as you use a relative link to reference it. Check out the Library Projects - Development considerations:

实际库项目存放在哪里没有关系,只要使用相对链接引用即可。查看图书馆项目 - 开发注意事项

  • Library project storage location

    There are no specific requirements on where you should store a library project, relative to a dependent application project, as long as the application project can reference the library project by a relative link. What is important is that the main project can reference the library project through a relative link.

  • 库项目存放位置

    相对于一个依赖的应用项目,对于库项目应该存放在哪里没有具体要求,只要应用项目可以通过相对链接引用库项目即可。重要的是,主项目可以通过相对链接引用库项目。

You should always use the Eclipse ADT plugin to select and set up Library Project Reference, i.e. right-click project -> Properties -> Android -> Add, then in the opened Project Selection window, select the Library Project list here (of cause you should import them in the same Eclipse workspace as your Main Project). This will add a android.library.reference using relative path into project.properties as well as show relative path in the Android preference window:

您应该始终使用 Eclipse ADT 插件来选择和设置 Library Project Reference,即右键单击项目 -> Properties -> Android -> Add,然后在打开的 Project Selection 窗口中,在此处选择 Library Project 列表(因为您应该将它们导入到与您的主项目相同的 Eclipse 工作区中)。这将使用相对路径将 android.library.reference 添加到 project.properties 中,并在 Android 首选项窗口中显示相对路径:

android.library.reference.2=../../../../../Documents and Settings/yorkw/Desktop/JakeWharton-Android-ViewPagerIndicator-f09acb0/library

If you directly alter it using absolute path from project.properties as below:

如果您使用 project.properties 中的绝对路径直接更改它,如下所示:

android.library.reference.1=C:\Documents and Settings\yorkw\Desktop\JakeWharton-Android-ViewPagerIndicator-f09acb0\library

Then after Eclipse refresh your project, you get the exact error described in your question, see my screenshot below: enter image description here

然后在 Eclipse 刷新您的项目后,您会收到问题中描述的确切错误,请参阅下面的屏幕截图: 在此处输入图片说明

Hope this helps.

希望这可以帮助。

回答by Rajesh

While importing the libraries, make sure that you tick the "Copy projects int workspace"check box. The library projects need to be in the same workspace for them to work.

导入库时,请确保勾选“Copy projects int workspace”复选框。库项目需要在同一个工作区中才能工作。

回答by Sandeep P

delete and import the project and lib again. build the lib project , add lib to project, still error shows.. rename the lib project. this worked for me ....

删除并再次导入项目和lib。构建lib项目,将lib添加到项目中,仍然显示错误..重命名lib项目。这对我有用....