通过gradle使android github项目可用

时间:2015-10-04 11:19:14

标签: android github android-gradle build.gradle

我使用android studio创建了一个库项目并将其上传到Github

我想要做的是,让任何想要使用这个简单的gradle命令的人都可以使用该项目。

dependencies {
   compile 'com.github.myprojectname'
}

我该怎么做?

2 个答案:

答案 0 :(得分:2)

使用gradle在github中使用项目:

  • 在MavenCentral或Jcenter

  • 中发布
  • 使用JitPack

在这种情况下,添加repo:

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

并添加如下依赖项:

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

如果您想在MavenCentral上发布工件,可以阅读this post

答案 1 :(得分:1)

您应该在maven central或jcenter上或在互联网上的某个地方上传您的项目。

然后在gradle.build中,您的用户指定:

repositories {
    mavenCentral()
}

或类似,然后他们指定您的依赖

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