简体   繁体   English

使用 ActionBarSherlock 和支持库

[英]Using ActionBarSherlock and the support library

I'm trying to add menus to my app, and for compatibility with older versions of android I decided to try ActionBarSherlock.我正在尝试向我的应用程序添加菜单,为了与旧版本的 android 兼容,我决定尝试使用 ActionBarSherlock。

My app uses the support v4 library heavily, for example it uses ViewPager .我的应用程序大量使用 support v4 库,例如它使用ViewPager

Now, when I added ActionBarSherlock I got the "jar mismatch" error.现在,当我添加 ActionBarSherlock 时,我收到了“jar 不匹配”错误。 Fixed that by removing the support library jar from the build path.通过从构建路径中删除支持库 jar 来修复该问题。 but then I get "cannot be resolved to a type" for all the things that use the support library.但是后来我得到“无法解析为类型”的所有使用支持库的东西。 I got it that ABS exports a few classes such as SherlockFragmentsActivity but it doesn't have anything like SherlockViewPager .我知道 ABS 导出了一些类,例如 SherlockFragmentsActivity 但它没有像SherlockViewPager这样的东西。

How can I use the support library, or am I missing something here?我如何使用支持库,或者我在这里遗漏了什么?

I don't know if there is other way to fix it, but just copy the v4 support library from ABS to your project (or the other way around) and add it to the build path.我不知道是否有其他方法可以修复它,但只需将 v4 支持库从 ABS 复制到您的项目(或其他方式)并将其添加到构建路径中。 It should work and shouldn't get the "jar mismatch" error.它应该可以工作,并且不会出现“jar 不匹配”错误。 This is the way I do it in my projects.这就是我在项目中的做法。

ABS is already using the android support library. ABS 已经在使用 android 支持库。 If you are using it as well, make your project and ABS use the same version.如果您也在使用它,请使您的项目和 ABS 使用相同的版本。

An easy way is to remove the support library from your project and add to the ABS library project.一个简单的方法是从您的项目中删除支持库并添加到 ABS 库项目中。

That way the support library will be provided to your project at the same time as ABS这样,支持库将与 ABS 同时提供给您的项目

It looks like you have 2 versions of library.... one from the ABS and Second while you Added support library.看起来您有 2 个版本的库.... 一个来自 ABS,第二个来自您添加了支持库。 Once try to delete android-support-V4.jar from your lib folder and rebuild the project.一旦尝试从您的 lib 文件夹中删除 android-support-V4.jar 并重建项目。

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

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