配置开源项目 SlidingMenu 的问题

最近想研究一下开源项目 SlidingMenu,单是配置项目就花了好长的时间,断断续续的尝试,终于配置成功了,写下来和大家分享一下经验。

Step 1:导入依赖的项目和例子

打开项目 File -> Import -> Android -> Existing Android Code Into Workspace, 找到相应的目录,引入相应的工程

如果不知道如何将项目引入当前工程请参考链接1

Step 2: 解决依赖的项目存在的问题

  • Console error: Unable to resolve target ‘Google Inc.:Google APIs:16.

    Fix: 检查当前是否有相应版本的android avd的支持

  • List of errors: ACTION_POINTER_INDEX_MASK cannot be resolved android.
    HONEYCOMB cannot be resolved or is not a field
    LAYER_TYPE_HARDWARE cannot be resolved or is not a field
    LAYER_TYPE_NONE cannot be resolved or is not a field
    MATCH_PARENT cannot be resolved or is not a field
    The method getLayerType() is undefined for the type View
    The method setLayerType(int, null) is undefined for the type View

    Fix: 将最低版本改为较新的版本

Step 3: 解决 SlidingMenu 的例子项目问题

  • Console error: Found 2 versions of android-support-v4.jar in the dependency list,but not all the versions are identical (check is based on SHA-1 only at this time). Jar mismatch! Fix your dependencies

    Fix: 将几个替换成同一个版本的jar 包, Clean 一下项目

  • List of errors: The method getSupportActionBar() is undefined for the type BaseActivity
    The method getSupportMenuInflater() is undefined for the type BaseActivity
    The method onCreateOptionsMenu(Menu) of type BaseActivity must override or implement a supertype method
    The method onOptionsItemSelected(MenuItem) in the type Activity is not applicable for the arguments
    The method onOptionsItemSelected(MenuItem) of type BaseActivity must override or implement a supertype method
    The method onOptionsItemSelected(MenuItem) of type ResponsiveUIActivity must override or implement a supertype method

    Fix: 打开 SlidingMenu library 项目的SlidingFragmentActivity.java  在头部添加引用:

    import com.actionbarsherlock.app.SherlockFragmentActivity;

    将:

    public class SlidingFragmentActivity extends FragmentActivity implements SlidingActivityBase {

    改为:

    public class SlidingFragmentActivity extends SherlockFragmentActivity implements SlidingActivityBase {

    如果错误仍存在就clean一下工程

Tip:保证你的例子项目中引入了ActionBarSherlock和SlidingMenu类库

参考:

http://stackoverflow.com/questions/14057367/exact-procedure-to-add-jfeinstein10-slidingmenu-in-android-project/14118683#14118683

http://boroniatechnologies.com/installing-slidingmenu-android-library-and-example/


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值