DEV Community

Cover image for Organizational Tip for Gradle
Corey Johnson
Corey Johnson

Posted on

Organizational Tip for Gradle

If you're anything like me, Gradle can be a bit of a mystery at times. I'm trying to better understand it and what kinds of things I can do to make it my own!

Here's the TL;DR that I included in my post:

1) Create a libraries.gradle file in your root project folder

2) In your project-level gradle, write apply from: 'libraries.gradle' above the buildscript block

3) Declare your dependencies in libraries.gradle, using ext.versions for the version codes, ext.libraries for the gradle artifacts, and ext.libPacks for the implementation groups

4) To use in your module’s build.gradle file in the dependencies block, all you need to do is write libPack.retrofit or libPack.glide

A little more longwinded explanation is here: https://medium.com/@cor.johnson/a-simple-way-to-improve-your-android-build-gradle-files-c7325731b3ea


If anyone has any other awesome tricks they use, I'd love to hear about them!

Top comments (0)