Thanks to visit codestin.com
Credit goes to proandroiddev.com

Sitemap

ProAndroidDev

The latest posts from Android Professionals and Google Developer Experts.

Better Dependency Management Using buildSrc + Kotlin DSL

Dependency management for better reusability and easy maintenance

5 min readJun 22, 2021

--

Press enter or click to view image in full size

Introduction

Since the start of using Android Studio, Gradle has become a central place for managing many things like dependencies, config data, flavours, etc. And maintaining the dependencies across multi-module projects has become a challenge over time. Let’s see in detail how the evolution of dependencies management across multi-module projects happened and the problems faced. Please check out my previous post on Kotlin DSL for a better understanding

The core part of this post is how we can achieve better dependencies management using buildSrc and Kotlin DSL

Problem

If you want to skip the evolution process move to the usage of buidSrc with Kotlin DSL section else continue reading.

Let’s take a multi-module app to understand the problem. Manually declaring versions along with dependencies across multi modules is our first approach. That would look something like below

At first module build.gradle file we declare dependencies

implementation "androidx.appcompat:appcompat:1.0.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.41"
xxxxxx

--

--

ProAndroidDev
ProAndroidDev

Published in ProAndroidDev

The latest posts from Android Professionals and Google Developer Experts.

Satya Pavan Kantamani
Satya Pavan Kantamani

Written by Satya Pavan Kantamani

Android Dev, Interested in Traveling, App development. Based in Hyderabad, India. Catch me at https://about.me/satyapavankumar

Responses (7)