【问题标题】:ActionBarSherlock library is full of errors after being importedActionBarSherlock 库导入后报错
【发布时间】:2012-06-23 00:20:02
【问题描述】:

好的,我正在尝试让 ActionBarSherlock 工作,所以我通过以下方式导入了库:

Creating New Project > Create Project From Existing Source > Choosing library from the ActionBarSherlock folder

之后我使用相同的方法从示例文件夹中导入了一个示例项目,库和示例都设置为 Android 15 Build Path!

我的问题是,库中出现了超过 100 个错误,关于 Call 的各种东西都需要 api 级别 11,而我不知道是什么问题!

我尝试过的事情:
清洁工程
将构建路径设置为 13、14 和 15

大部分错误说:

Call requires API level 11 (current min is 8): android.app.something

更新:我尝试右键单击 lib 文件并单击添加到构建路径,但没有成功,这些是我遇到的一些错误:

Description Resource    Path    Location    Type
The method add(CharSequence) of type MenuWrapper must override a superclass method  MenuWrapper.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 33 Java Problem
The method add(int, int, int, CharSequence) of type MenuWrapper must override a superclass method   MenuWrapper.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 43 Java Problem
The method add(int, int, int, int) of type MenuWrapper must override a superclass method    MenuWrapper.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 48 Java Problem
The method add(int) of type MenuWrapper must override a superclass method   MenuWrapper.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 38 Java Problem
The method addIntentOptions(int, int, int, ComponentName, Intent[], Intent, int, MenuItem[]) of type MenuWrapper must override a superclass method  MenuWrapper.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 81 Java Problem
The method addOnAttachStateChangeListener(View_OnAttachStateChangeListener) of type ActionMenuItemView must override a superclass method    ActionMenuItemView.java /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 84 Java Problem
The method addOnAttachStateChangeListener(View_OnAttachStateChangeListener) of type ActionMenuPresenter.OverflowMenuButton must override a superclass method    ActionMenuPresenter.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 627    Java Problem
The method addSubMenu(CharSequence) of type MenuWrapper must override a superclass method   MenuWrapper.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 61 Java Problem
The method addSubMenu(int, int, int, CharSequence) of type MenuWrapper must override a superclass method    MenuWrapper.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 71 Java Problem
The method addSubMenu(int, int, int, int) of type MenuWrapper must override a superclass method MenuWrapper.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 76 Java Problem
The method addSubMenu(int) of type MenuWrapper must override a superclass method    MenuWrapper.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 66 Java Problem
The method clear() of type MenuWrapper must override a superclass method    MenuWrapper.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 101    Java Problem
The method clearHeader() of type SubMenuWrapper must override a superclass method   SubMenuWrapper.java /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 49 Java Problem
The method close() of type MenuWrapper must override a superclass method    MenuWrapper.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 157    Java Problem
The method collapseActionView() of type ActionMenuItem must override a superclass method    ActionMenuItem.java /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 264    Java Problem
The method collapseActionView() of type MenuItemImpl must override a superclass method  MenuItemImpl.java   /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 612    Java Problem
The method collapseActionView() of type MenuItemWrapper must override a superclass method   MenuItemWrapper.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 254    Java Problem
The method collapseItemActionView(MenuBuilder, MenuItemImpl) of type ActionBarView.ExpandedActionViewMenuPresenter must override a superclass method    ActionBarView.java  /com_actionbarsherlock/src/com/actionbarsherlock/internal/widget    line 1497   Java Problem
The method describeContents() of type ActionMenuPresenter.SavedState must override a superclass method  ActionMenuPresenter.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 557    Java Problem
The method expandActionView() of type ActionMenuItem must override a superclass method  ActionMenuItem.java /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 259    Java Problem
The method expandActionView() of type MenuItemImpl must override a superclass method    MenuItemImpl.java   /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 598    Java Problem
The method expandActionView() of type MenuItemWrapper must override a superclass method MenuItemWrapper.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 249    Java Problem
The method expandItemActionView(MenuBuilder, MenuItemImpl) of type ActionBarView.ExpandedActionViewMenuPresenter must override a superclass method  ActionBarView.java  /com_actionbarsherlock/src/com/actionbarsherlock/internal/widget    line 1471   Java Problem
The method findItem(int) of type MenuWrapper must override a superclass method  MenuWrapper.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 127    Java Problem
The method flagActionItems() of type ActionBarView.ExpandedActionViewMenuPresenter must override a superclass method    ActionBarView.java  /com_actionbarsherlock/src/com/actionbarsherlock/internal/widget    line 1466   Java Problem
The method flagActionItems() of type MenuPopupHelper must override a superclass method  MenuPopupHelper.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 280    Java Problem
The method getActionProvider() of type ActionMenuItem must override a superclass method ActionMenuItem.java /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 243    Java Problem
The method getActionProvider() of type MenuItemWrapper must override a superclass method    MenuItemWrapper.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 240    Java Problem
The method getActionView() of type MenuItemWrapper must override a superclass method    MenuItemWrapper.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 229    Java Problem
The method getAlphabeticShortcut() of type MenuItemWrapper must override a superclass method    MenuItemWrapper.java    /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu line 123    Java Problem

【问题讨论】:

  • 你能说出至少几个具体的错误吗?
  • @EboMike 我编辑了我的问题。
  • @AlexLockwood 抱歉,它有大约 150 个,他们都说了不同的话。我添加了更多错误

标签: java android actionbarsherlock android-actionbar


【解决方案1】:
  • 转到项目属性 > Java 编译器。使用 JDK 1.6。
  • 确保您使用 Android 4.0+ 编译库和应用程序
  • 确保您的 targetSdkVersion 为 14 或更高版本。

【讨论】:

  • 非常感谢,成功了! :D 我在 JDK 1.5 上设置了它。 p.s. ActionBarSherlock 太棒了!
  • @Jake Wharton 是那个很棒的图书馆的创造者......我们都应该感谢他......
  • 这应该在常见问题解答中。你应该得到一枚奖牌。
  • 非常感谢……你太棒了……你节省了我很多时间来参与这个问题……你真的应该得到一枚奖牌
【解决方案2】:
  1. 在项目资源管理器中,找到libs 目录中的android-support-v4.jar 文件。右键单击此文件并将其添加到您的构建路径:

    构建路径 --> 添加到构建路径

【讨论】:

    【解决方案3】:

    右键,选择属性,java build path,libraries选项卡,点击Add Libraries... 和Add JRE System Library 1.6

    【讨论】:

      【解决方案4】:

      右击,选择Properties,Java Build Path,Libraries选项卡;点击“添加库”并添加“JRE System Library 1.6”。

      确认修改,并删除您稍后添加的 JRE 系统库。

      【讨论】:

        【解决方案5】:

        验证新的库清单包是“com.actionbarsherlock”

        (也许只有我一个人,但我在已经提取库文件夹的地方创建了项目。)

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2013-08-16
          • 1970-01-01
          • 2012-12-21
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多