android – How to make your library available for adding via gradle implementation?

Question:

I understand how to create an Android library and how to upload the code to Github, but how to make this library available for download over the Internet using the standard gradle dependency mechanism? Those. how to make my library can be added to any project using a script:

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

As far as I understand, this should be done using JitPack , but how exactly to do it?

Answer:

There are many ways to publish, I know at least 4. There are probably more.

To publish on bintray , in addition to the obvious steps like setting up a login in bintray, you need to write something like this in Gradle:

apply plugin: 'com.novoda.bintray-release'
apply plugin: 'com.android.library'

//blah-blah


publish {

    def groupProjectID = 'com.mylibrary'
    def artifactProjectID = 'mylibrary'
    def publishVersionID = '0.1.0'

    userOrg = 'my user name'
    repoName = 'mylibrary'
    groupId = groupProjectID
    artifactId = artifactProjectID
    publishVersion = publishVersionID
    desc = 'mylibrary description'
    website = 'https://github.com/myusername/MyLibrary'
}

Well, etc.

Step by step instructions here

Scroll to Top