具体步骤
在github中建立你的项目


Paste_Image.png
使用sourceTree或git命令把项目clone到本地

Paste_Image.png

Paste_Image.png
使用AndroidStuido新建项目,并把项目地址修改为你刚刚clone到本地的"test4github"中,并创建一个类库lib

Paste_Image.png
我们现在在类库中添加一个加法

Paste_Image.png
在工程的gradle添加
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'

Paste_Image.png
在你类库lib_test的gradle添加,YourUsername是你的github账号
apply plugin: 'com.github.dcendents.android-maven'
group='com.github.YourUsername'

Paste_Image.png
如果没有wrapper文件夹,gradlew wrapper ./gradlew install
这里使用sourceTree把刚创建的项目提交到github中

Paste_Image.png

Paste_Image.png
刷新github后可以看出,我们刚刚新建的lib_test库已经成功提交到github上了。
发布项目

Paste_Image.png

Paste_Image.png
发布成功后成功获得仓库地址。

Paste_Image.png
生成依赖库
把发布成功的仓库地址 https://jitpack.io/

Paste_Image.png