Jason John
Jason John

Reputation: 936

How to find gradle dependency URL

For example, here is MikePenz MaterialDrawer library:

compile('com.mikepenz:materialdrawer:4.6.4@aar') {
    transitive = true
}

Here's another one for the FancyButtons library

compile 'com.github.medyo:fancybuttons:1.5@aar'

Where did these compile lines come from? I ask because I just forked a project and made a slight change, and now I want to use this project in my app, but I don't want to download the project, import module into Android Studio, and then go from there (I haven't had much luck). How can I create a one-line snippet.

Here's the project I want to compile using this method

Upvotes: 1

Views: 2106

Answers (1)

RaGe
RaGe

Reputation: 23707

For the examples your listed, they likely come from jCenter or mavenCentral. Where you get them from is determined from your build.gradle repositories section. You might have something like:

repositories {  
 jCenter()  
}

which is basically saying, when a line like compile ... appears in the dependencies section, go look for the required files on jCenter.

How did the files get there in the first place? The authors of the original projects published their aar files to these repositories. How do you get your modified libraries up there as well? Look up publishing. Here is the help page on publishing to jCenter.

Thing to note is that, you do not necessarily have to publish to a public repository. You can even host your own local repository or even just publish to a local filesystem folder. Which ever repo you publish to, make sure to include that repo in the repositories section of the other project that you want to consume your library from and the dependency will be automatically fetched from the repo with just a compile ... line.

Upvotes: 4

Related Questions