Tuesday, November 12, 2013

Android: How to install and import Library Support v7 to your project

[process accomplished using Ubuntu 12.04 LTS + Eclipse (from ADT Bundle)]


  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. (without copying files)
    3. Browse to the SDK installation directory and then to the Support Library folder. For example, if you are adding the appcompat project, browse to <sdk>/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 and android-support-v7-appcompat.jar files to the build path. (don't import v4 now. It could be create incompatibilities if your project already imported it).
    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.(don't check v4 now. It could be create incompatibilities if your project already did it).
    8. Uncheck Android Dependencies.
    9. Click OK to complete the changes.
You now have a library project for your selected Support Library that you can use with one or more application projects.
Add the library to your application project:
  1. In the Project Explorer, right-click your project and select Properties.
  2. In the category panel on the left side of the dialog, select Android.
  3. In the Library pane, click the Add button.
  4. Select the library project and click OK. For example, the appcompat project should be listed as android-support-v7-appcompat.
  5. In the properties window, click OK.


A picture is worth a thousand words: enter image description here


You can follow this link too:

http://developer.android.com/tools/support-library/setup.html#download



No comments:

Post a Comment