Tuesday, December 10, 2013

Create library project with the appcompat v7 support library

It's outdate post:

Make sure "Android Support Repository" is checked to install in SDK Manager. In current Android Studio, 'com.android.support:appcompat-v7:23.+' will be added by default if you create project using Android Studio Wizard.


To use the ActionBar APIs in the support library. So before you can add the action bar, you must set up your project with the appcompat v7 support library by following the instructions in the Support Library Setup.


  1. Make sure you have downloaded the Android Support Library using the SDK Manager.
  2. Create a library project and ensure the required JAR files are included in the project's build path:
    1. Select File > Import.
    2. Select Existing Android Code Into Workspace and click Next.
    3. Browse to the SDK installation directory and then to the Support Library folder. For example, if you are adding theappcompat project, browse to /extras/android/support/v7/appcompat/.
    4. Click Finish to import the project. For the v7 appcompat project, you should now see a new project titled android-support-v7-appcompat.
    5. In the new library project, expand the libs/ folder, right-click each .jar file and select Build Path > Add to Build Path. For example, when creating the the v7 appcompat project, add both the android-support-v4.jar andandroid-support-v7-appcompat.jar files to the build path.
    6. Right-click the library project folder and select Build Path > Configure Build Path.
    7. In the Order and Export tab, check the .jar files you just added to the build path, so they are available to projects that depend on this library project. For example, the appcompat project requires you to export both the android-support-v4.jar and android-support-v7-appcompat.jar files.
    8. Uncheck Android Dependencies.
    9. Click OK to complete the changes.


next:
Example of using ActionBarCompat with android-support-v7-appcompat



ActionBarCompat Step-by-step

4 comments:

  1. Hi Andr.oid Eric: Thanks for describing the process of implementing the ActionBar Compat. You have explained it very well and it has been a great help to me in my project.

    Cheers...

    ReplyDelete
  2. Thanks a lot! However if you're still have problem after performing these steps. All you need to do is click on Project->Properties->Android->Library then add the appcompat project you created and that should be done!

    ReplyDelete
  3. Please which version of Android sdk are you using because am not seeing android support library in my own downloaded sdk

    ReplyDelete
  4. hello Butter Joseph,

    Make sure "Android Support Repository" is selected to install in SDK Manager. In current Android Studio, 'com.android.support:appcompat-v7:23.+' will be added by default if you create project using Android Studio Wizard.

    ReplyDelete