DEV Community

Cover image for Organizational Tip for Gradle
Corey Johnson
Corey Johnson

Posted on

1 1

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!

Sentry mobile image

Mobile Vitals: A first step to Faster Apps

Slow startup times, UI hangs, and frozen frames frustrate users—but they’re also fixable. Mobile Vitals help you measure and understand these performance issues so you can optimize your app’s speed and responsiveness. Learn how to use them to reduce friction and improve user experience.

Read the guide →

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay