In this post, you will learn about the Android Support Library and How to add in your Android Studio project.

In Android app development, support libraries have an important role. Without them, It might difficult to provide a consistent look and feel in all devices.

Okay, tell me in detail.



What is Android support library?

There are many devices still running in Jelly bean and below versions. So you need to give the same importance for old and new devices While making an app. Otherwise, the App in old devices looks dull when compared to new ones.
That may affect the app’s market. To avoid this trouble, Android introduced the Support library. These are set of code libraries that provide backward compatibility and you can find it on Android SDK. These libraries experiences revisions for fresh features and bug fixes. Package name shows which Android Version it supports from.
For example : android.support.v7.app.AppCompatActivity – It can be used with API level 7 and higher.

After the release of support-library 26.0.0, support for minimum API level change it to API level 14 . So Don’t confuse with v* notation

The Android Support library includes

  • Palette – It used to take out colors from image.
  • CardView – Provides card look like widget.
  • leanback – Helps to make UI for TV apps.
  • Mediarouter – Supports for Media Routes.
  • gridLayout – Arranges widgets in grid manner.
  • RecyclerView – New version of ListView and GridView.
  • AppCompat – Provides support for ActionBars.
  • support-v4 library – User Interface features and other components.
  • MultiDex – helps to make apk contains multiple dex files.
  • RenderScript – Enables latest features of RenderScript .
  • Annotations – improves code .

If you are a beginner and experimenting with online tutorials, there may be a chance to edit the gradle file directly for adding the library as a dependency, sometimes wait for a download too.

Before doing that you can perform the following procedures to find and add an available version of the same support library. You can use this way to add AppCompat, Design, CardView, RecyclerView and so on.

There are two methods you are going to learn here. First one is simple and fast. The second method is an old one. But it’s good to know about that.

We assume that you have opened Android Studio and your project.

Method 1 – How to add support library in Android Studio

how to add support library in android studio

  1. Open build.gradle(Module:app) file
  2. how to add support library in android studio

  3. Use ALT + ENTER and select Add library dependency
  4. .
    how to add support library in android studio

  5. Select from the list, Here I am adding CardView.
  6. support library added to android studio

  7. CardView is added to my project. Just like this, you can add any library. If there is a sync needed. Just sync it.

Method 2 – How to add support libray in Android Studio

    file project structure - how to add support library in android studio

  1. File->Project Structure you can use “Ctrl + Alt + Shift + S ” key combinations.
  2. app module - how to add support library in android studio -androidride.com

  3.  click  the app module.
  4. dependency tab and + button - how to add support library in android studio - androidride.com

  5. Click the Dependencies tab, you will see already added libraries below. click the + Button shown in the  Right side of the window.
  6. library dependency - how to add support library in android studio - androidride.com

  7.  Choose library dependency from available options.
  8. choose library dependency dialog - how to add support library in android studio - androidride.com

  9. Choose library dependency dialog will be visible now. You can search here or choose the desired library that you want from the list. After your selection, just click OK.
  10. library added - how to add support library in android studio - androidride.com

  11. The selected library will be added as a dependency in your dependencies tab list and click OK.
  12. build.gradle - how to add support library in android studio -androidride.com

  13. Just look at the build.gradle(Module: app)  file dependency section, Android Studio will add your selected library. Please share it and your valuable comments will help us to improve.

 

Conclusion

The Android Support library helps to reduce the headache of developers by providing backward compatibility. Users also feel fresh and happy with their old device. There is no complexity in adding support library in Android Studio. You can do it in simple steps. I assume the above words might have helped you.

More information: Support Library Features Guide

Please disable your adblocker or whitelist this site!