Git Dependencies in Gradle

I found it a pain to get git dependencies working in Gradle, so I decided to write this ugly blog post for my future self and possibly some other desperately-searching Android developers.

The problem:

Including git project dependencies (e.g. a common library among your apps).

The solution:

Add this to your root build.gradle:

 

To your root settings.gradle:

 

To your app build.gradle:

 

And that is it!!

To update the library, you can just go to the root build/library/ and run a git pull.

Thanks goes to:

ajoberstar for suggesting the Grgit.clone method (http://stackoverflow.com/questions/13719676/gradle-how-to-clone-a-git-repo-in-a-task)

athor for explaining how to neatly include projects in settings.gradle (http://stackoverflow.com/questions/25186187/gradle-module-and-git-submodule)

 

Leave a Reply

Your email address will not be published. Required fields are marked *