How to centralize the support libraries dependencies in gradle

Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries.

A very good way is to separate gradle build files, defining something like:
In gradleScript/dependecies.gradle:

ext {
    supportLibrary = '22.2.1'

    //Support Libraries dependencies
    supportDependencies = [
            design           :    "${supportLibrary}",
            recyclerView     :    "${supportLibrary}",
            cardView         :    "${supportLibrary}",
            appCompat        :    "${supportLibrary}",
            supportAnnotation:    "${supportLibrary}",
In the top level file build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
    dependencies {
        classpath ''

// Load dependencies
apply from: 'gradleScript/dependencies.gradle'
In the module1/build.gradle:

// Module build file

dependencies {
    compile supportDependencies.appCompat
Here you can find the full gist.

Thanks to Fernando Cejas and this blog.


  1. Very Nice Blog, You are spreading very good information among us… Yes Web Hosting plays very important role in business world. And it is important to have the best hosting services.
    Germany VPS Hosting

  2. This Article is Worth of sharing. The information is helpful for sure! Keep going like this!
    Germany VPS Hosting

  3. Am really impressed about this blog because this blog is very easy to learn and understand clearly.This blog is very useful for the college students and researchers to take a good notes in good manner,I gained many unknown information.
    Data Science Training In Chennai

    Data Science Online Training In Chennai

    Data Science Training In Bangalore

    Data Science Training In Hyderabad

    Data Science Training In Coimbatore

    Data Science Training

    Data Science Online Training

  4. Thanks for provide great informatics and looking beautiful blog, really nice required information & the things i never imagined and i would request, wright more blog and blog post like that for us. Thanks you
    DevOps Training in Chennai

    DevOps Online Training in Chennai

    DevOps Training in Bangalore

    DevOps Training in Hyderabad

    DevOps Training in Coimbatore

    DevOps Training

    DevOps Online Training

  5. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
    best machine learning course online
    learn machine learning online
    Machine Learning Online training hyderabad

  6. Stay Home And Be safe Carona effect Nice to see your blog keep updating offers & coupons Clovia Coupons and Offers- Find the latest Filpkart, Nykaa, nnnow, paytmall, Clovia Coupons and Best Offers for Men & women online shopping at Tracedeals.
    Amazon offers
    Clovia offers
    Flipkart offers
    Nykaa offers
    Nnnow offers
    Paytmmall offers
    oppo Mobile offers
    Samsung Mobile Phone
    Flipkart Coupons
    Flipkart sale
    Bookmyshow Coupons

  7. Thank you so much for sharing your brilliant thoughts with us. Visit Ogen Infosystem for creative Website Designing and SEO Services in Delhi, India.
    Website Designing Company in Delhi


Post a Comment

Popular posts from this blog

NotificationListenerService and kitkat

Expand and collapse animation

NotificationListenerService and a Whatsapp extension for Dashclock