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

标签 android eclipse actionbarsherlock android-viewpager android-library

我正在尝试获取 ActionBarSherlockViewPagerIndicator为我的项目设置的库,但我似乎遇到了一些问题。我早些时候给 Jake Wharton(开发者)发了几条关于这件事的消息,得到了一些回复,但没有得到任何答复——我认为他正忙于其他一些事情。

我的问题是,对于 VPI 和 ABS For both VPI and ABS

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

有趣的是,如果我加载提供的示例 - 它们可以正常工作并链接到他的库;但是当我将库添加到我的项目时 - 会发生上述情况。

最佳答案

在哪里存储实际的库项目并不重要,只要您使用相对链接来引用它即可。查看 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.

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

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

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

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

然后在 Eclipse 刷新您的项目后,您会得到问题中描述的确切错误,请参见下面的屏幕截图: enter image description here

希望这会有所帮助。

关于android - Eclipse 不会将项目识别为库 (ActionBarSherlock/ViewPagerIndicator),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10200751/

相关文章:

android - 使用 SherlockFragmentActivity 时应用崩溃

API 级别 11 之前的 Android 查看动画

android - 在操作栏中添加 TextView - android

java - 从 java 代码更改图像布局和位置

java - Android javax.naming.* 替换?

java - Android onCreate 中的 NullPointerException

java - 在 Eclipse 运行配置中如何引用用户名?

android - ActionBarSherlock 同一选项卡中的重叠 fragment

java - 自定义 ListView 和 Sherlock 列表 fragment

java - 关于在Eclipse中添加库