vishnus
vishnus

Reputation: 728

Making android github project available via gradle

I have created a library project using android studio and uploaded it on Github

What I want to do is, make the project available to anyone wanting to use it with this simple gradle command.

dependencies {
   compile 'com.github.myprojectname'
}

How can I do it?

Upvotes: 1

Views: 130

Answers (2)

Angela
Angela

Reputation: 316

To use a project in github with gradle:

  • publish it in MavenCentral or Jcenter

  • use JitPack

In this case add the repo:

repositories {
        // ...
        maven { url "https://jitpack.io" }
    }

and add the dependency like this:

 dependencies {
        compile 'com.github.User:Repo:Tag'
    }

If you want to publish an artifact on MavenCentral, you can read this post.

Upvotes: 2

Alexander
Alexander

Reputation: 48252

You should upload your project on maven central or jcenter or on your own repository somewhere on the internet.

Then in the gradle.build your users specify:

repositories {
    mavenCentral()
}

or similar and then they specify your dependency

dependencies {
   compile 'com.github.myprojectname+'
}

Upvotes: 1

Related Questions