SlidingMenu is a helpful Android library for developers. It creates a side navigation like the Facebook app but it is not easy to setup the library nor the example. Here you will find the steps to make the library and example free of errors and ready to use.

Step 1: Import the library and example

Download the library as well as the app on GitHub (https://github.com/jfeinstein10/slidingmenu).
Then, unzip the file and create a new project in Eclipse. Select Android Project from Existing Code and click Next. Click Browse and choose the folder where you unzip the SlidingMenu library. Check Copy projects into workspace and click Finish. You have imported
the library and example but you have an X icon next to the SlidingMenu library project and an exclamation mark icon next to the example project.

Step 2: Fix errors in SlidingMenu library project

The following list describes the possible errors that you might have after importing the library:

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

    Fix: Go to Properties for library and check Google APIs for the desired platform.

  • 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: Change the min sdk version of the library manifest with a recent one.

Step 3: Fix errors in SlidingMenu example project

After importing the example, these are the possible errors:

  • 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: Identify which project has the latest version and copy it on the old version. Clean the projects and restart eclipse if the error
    messages still appear in the console tab.

  • 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: Open SlidingFragmentActivity class of the SlidingMenu library project and add the following code before declaring the class:

    import com.actionbarsherlock.app.SherlockFragmentActivity;

    Then, replace the class declaration:

    public class SlidingFragmentActivity extends FragmentActivity implements SlidingActivityBase {

    with:

    public class SlidingFragmentActivity extends SherlockFragmentActivity implements SlidingActivityBase {

    Clean and build the project if the error messages still appear.

Tip:Make sure that your example project is referencing the ActionBarSherlock and SlidingMenu library contained in your workspace.

Summary: Although SlidingMenu is a helpful Open Source library for Android developers, setting up the library and the example are not
easy to do. So, this article intends to save you time on researching each error that you get after importing the library and example files.

导入android SlidingMenu 应用的更多相关文章

  1. Android SlidingMenu侧滑菜单使用

    把下载的侧滑菜单压缩包打开,会有一个library文件夹,在eclipse中import existing android code into workspace,导入library文件夹,并且选择作 ...

  2. Android slidingmenu详细解释 滑动的优化

    Android slidingmenu 详细解释 性能优化 转载请注明:   http://blog.csdn.net/aaawqqq 简单介绍 SlidingMenu 是github 上Androi ...

  3. eclipse — 导入android项目后识别成java项目的问题及解决

    最近在eclipse导入android项目的时候遇到了奇葩问题,再此记录 遇到的问题就是:将完好的android项目导入到eclipse的时候,原本这是一个很容易的事情,但是导入成功后发现,,,靠ec ...

  4. GJM :Unity3d导出eclipse工程,导入Android Studio

    unity3d导出eclipse工程,导入Android Studio 标签: unity3Dandroid studio 2016-08-11 10:42 398人阅读 评论(1) 收藏 举报 分类 ...

  5. Eclipse导入Android项目的正确方法

    转自Eclipse导入Android项目的正确方法 看网上流传的Eclipse导入项目的方法都是在新建Android程序时使用"Create project form existing so ...

  6. eclipse 导入Android项目时报告 Invalid Project Description

    现象描述: 1.新建Android项目XX2.删除Android项目XX3.使用Existing Android Code Into Workspace(EACIW)导入Android项目XX,报错: ...

  7. Eclipse项目导入Android Stuio 配置出现 Timeout waiting to lock buildscript class cache for build file 'H:\studioproject\Generic_SN\build.gradle'

     Eclipse项目导入Android Stuio 配置出现 Error:Timeout waiting to lock buildscript class cache for build file  ...

  8. 导入android项目在eclipse中会报@Override错误

    很多时候导入android项目在eclipse中会报@Override错误,这是由于java编译器的版本不正确,Java 1.5的编译器默认对父类的方法进行覆盖,采用@Override进行说明:但1. ...

  9. 解决:eclipse导入android时工程下没有R文件的问题,以及style.xml文件报错

    解决:eclipse导入android时工程下没有R文件的问题,以及style.xml文件报错

随机推荐

  1. 关于ROS学习的一些反思

    距离发布上一篇ROS的博客已经过去两年了,才发现原来自己已经这么久可没有写过关于ROS的文章,想来很是惭愧.这两年时间,自己怀着程序员的梦想,研究过RTOS,探索过Linux,编写过Android应用 ...

  2. UIScrollView实现图片轮播器的无限滚动

    简介 在现在的一些App中常常见到图片轮播器,一般用于展示广告.新闻等数据,在iOS内并没有现成的控件直接实现这种功能,但是通过UIScrollView的允许分页设置,可以实现滚动轮播的功能. 轮播原 ...

  3. Dynamics CRM2015 Update1 新功能之表单增强功能

    CRM2015 Update 1发布后,系统的界面的变化很大,仔细观察后会发现表单窗体也有些不同了,在CRM2015 Update1的官方介绍中对此变化的解释是起用了新的窗体呈现引擎,让界面更好看加载 ...

  4. Android必知必会-获取View坐标和长宽的时机

    如果移动端访问不佳,请访问–>Github版 背景 最近要实现一个功能,用到了一些属性动画,需要获取一些View的坐标信息,设计图如下: 这里我使用的是DialogFragment来实现的,可以 ...

  5. 深入理解CoordinatorLayout.Behavior

    要研究的几个问题 一.Behavior是什么?为什么要用Behavior? 二.怎么使用Behavior? 三.从源码角度看为什么要这么使用Behavior? 一.Behavior是什么?为什么要用B ...

  6. 03 ImageView 图片

    四  ImageView   父类 : view     >概念:展示图片的控件       >属性:      <!--  android:adjustViewBounds=&qu ...

  7. iOS中 断点下载详解 韩俊强的博客

    布局如下: 基本拖拉属性: #import "ViewController.h" #import "AFNetworking.h" @interface Vie ...

  8. UNIX环境高级编程——Linux系统调用列表

    以下是Linux系统调用的一个列表,包含了大部分常用系统调用和由系统调用派生出的的函数.这可能是你在互联网上所能看到的唯一一篇中文注释的Linux系统调用列表,即使是简单的字母序英文列表,能做到这么完 ...

  9. JAVA之旅(十三)——线程的安全性,synchronized关键字,多线程同步代码块,同步函数,同步函数的锁是this

    JAVA之旅(十三)--线程的安全性,synchronized关键字,多线程同步代码块,同步函数,同步函数的锁是this 我们继续上个篇幅接着讲线程的知识点 一.线程的安全性 当我们开启四个窗口(线程 ...

  10. C# 基于密码的身份验证报错问题System.Net.NetworkCredential

    今天碰到个很奇怪的问题,在用下面这段代码调试时获取身份验证时居然报错,更奇怪的是本地VS中调试正常而在虚机上调试就报错了 ClientCredentials clientCredentials = n ...