Tag Archives: Android development

Home / Posts tagged "Android development"

Installing SlidingMenu Android library and example


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.

About Boronia Technologies

Boronia Technologies is the business name of Catherine Lebastard, an IT professional with extensive experience in web development and database administration. Catherine chose the name of Boronia as she likes flowers and purple color. The logo of her business is inspired on Boronia flower plus digital elements incorated inside the flower.


Why you should use my services?

Because I can guide you to the right path and provide you what you are looking for at the right price according to your budget. Also, I am able to develop or debug an application with any programming language that you request because I have the ability to learn at extremely fast pace and adapt easily to progress in technology.