How to add something to gradle for other users?

Viewed 130

How to add your own project to the gradle so other users can use it as a dependency? E.g.

dependencies {
    compile 'com.myDomain.myProject-v1.0'
}
5 Answers

You have to push it in a maven repo, private or public.
You can check for example the bintray repo (jcenter)

Assuming that Some Other Folder is a gradle project you could add something like the following to your settings.gradle file:

include ':module1'
project(':module1').projectDir = new File(settingsDir, '../Project B/Module 1')

You have to make it available in a repository. A very simple one is JitPack.

  • Host your lib on Github
  • Add JitPack in repositories
  • Add the dependency compile 'com.github.User:Repo:Tag'

Sample:

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

...

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

Full documentation

Please you need to study about how to make library (module) on android studio, what is jcenter, what is maven center and also study about bintray.com.

Related