# Manage Android dependencies versions using gradle extra properties.

DevFeed: [Manage Android dependencies versions using gradle extra properties.](<https://devfeed.tech/articles/manage-android-dependencies-versions-using-gradle-extra-properties-25827.md>)

Original publisher: [Read original article](<https://segunfamisa.com/posts/android-gradle-extra-properties>)

Author: Segun Famisa

Published: 2016-07-29T09:05:30Z

Content type: tutorial

Language: en

Sources: [Segun Famisa](<https://devfeed.tech/sources/segun-famisa.md>)

Topics: [Gradle](<https://devfeed.tech/topics/gradle.md>), [android-development](<https://devfeed.tech/topics/android-development.md>), [Android Studio](<https://devfeed.tech/topics/android-studio.md>), [Development](<https://devfeed.tech/topics/development.md>), [modules](<https://devfeed.tech/topics/modules.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [android-studio](<https://devfeed.tech/tags/android-studio.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [modules](<https://devfeed.tech/tags/modules.md>), [properties](<https://devfeed.tech/tags/properties.md>)

## AI overview

A tutorial on managing Android dependency versions with Gradle extra properties. It shows how to externalize repeated hardcoded version values and move shared configuration to the root project for reuse across multiple modules.

## Source excerpt

This is yet another tip you can use in improving your Android development experience and speed. We all love dependencies right? Yes we do! A typical Android studio project (you can stop reading now if you still use Eclipse 😑 seriously) has a project level build.gradle file and as many module-level build.gradle as there are modules. Dependencies are usually managed at the app-module level, and your app-module build.gradle file can quickly get messy from dependencies. It gets even worse, when you have other modules you reference in your app-module, each with its own dependencies. In this post, I'll show a quick way of making things look neat, and easy to maintain. Externalize hardcoded values. Let's say our project's app-module build.gradle looks like this: apply plugin: 'com.android.application' android { ... } ... dependencies { // support libraries compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:design:23.4.0' compile 'com.android.support:percent:23.4.0' compile 'com.android.support:cardview-v7:23.4.0' compile 'com.android.support:gridlayout-v7:23.4.0' //play services compile 'com.google.android.gms:play-services-location:9.2.1' compile 'com.google.android.gms:play-services-gcm:9.2.1' // other dependencies ... } You can see that we've repeated quite a number of versions, including the android support libraries. What we want to do is to externalize hardcoded values in our build.gradle file by leveraging gradle's extra properties. We can extract these hardcoded into an ext block. Our build.gradle file will now look like this: apply plugin: 'com.android.application' android { ... } ... ext { supportLibraryVersion = '23.4.0' playServicesVersion = '9.2.1' } dependencies { // support libraries compile "com.android.support:appcompat-v7:$supportLibraryVersion" compile "com.android.support:design:$supportLibraryVersion" compile "com.android.support:percent:$supportLibraryVersion" compile "com.android.support:cardview-v7:$supportLibraryVersion"