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. memcached实战系列(六)理解Memcached的数据存储方式

    Memcached的数据存储方式被称为Slab Allocator,其基本方式是: 1:先把内存分成很多个Slab,这个大小是预先规定好的,以解决内存碎片的问题.启动参数的时候配置进去的不懂得可以参考 ...

  2. iOS注册远程推送消息证书后提示此证书签发者无效的解决办法

    大熊猫猪·侯佩原创或翻译作品.欢迎转载,转载请注明出处. 如果觉得写的不好请多提意见,如果觉得不错请多多支持点赞.谢谢! hopy ;) 我们在编写关于远程推送消息的App时需要注册一个相关的证书,我 ...

  3. [ExtJS5学习笔记]第十七节 Extjs5的panel组件增加accodion成为折叠导航栏

    本文地址:http://blog.csdn.net/sushengmiyan/article/details/39102335 官方例子:http://dev.sencha.com/ext/5.0.1 ...

  4. EBS接口表关系概览(部分)

    ItemTable Relationship TransactionTable Relationship PO/PRTable Relationships ReceivingTable Relatio ...

  5. 【ShaderToy】跳动的心❤️

    写在前面 注:如果你还不了解ShaderToy,请看开篇. 作为ShaderToy系列的第一篇,我们先来点简单的.下面是效果: (CSDN目前不能传gif文件了,暂时空缺,可以看下面的原shader效 ...

  6. 带吸附效果的ViewPager(一)

    什么叫吸附效果?先看一个示例更为直观,借用网上的一个效果图: 类似这种效果的app很多,网上的实现方法也是很多,但各种重写各种监听又令人不胜其烦,今日突发奇想,顺着自己的思路实现了类似的效果,不敢独享 ...

  7. Android简易实战教程--第四话《最简单的短信发送器》

    首先配置一个布局: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmln ...

  8. Hash冲突解决

    hash的冲突不可避免的 1.开放地址法 开放地执法有一个公式:Hi=(H(key)+di) MOD m i=1,2,-,k(k<=m-1) 其中,m为哈希表的表长.di 是产生冲突的时候的增量 ...

  9. Red Hat Enterprise Linux 5 64-bit chinese language support config steps

    Red Hat Enterprise Linux 5 64-bit 系统下安装中文语言支持方法 测试环境:Windows2012+Vmvare9.0+Red Hat Enterprise Linux ...

  10. FFmpeg深入分析(一)

    最近在做一个关于监控的项目,要在iphone 客户端实现播放监控的实时视频以及录像视频.使用到了FFmpeg,看到这篇文章,写的非常不错.转自:http://blog.chinaunix.net/ui ...