1.首先配置插件 点击查看插件地址,打开需要发布到JitPack的项目,在项目build.gradle中,
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' //此句为需要增加的内容 } }
2.在module的build.gradle中添加配置,
我选择的是一个library,所以默认生成的是apply plugin: 'com.android.library',如果是一般的module此句则为apply plugin: 'com.android.application'
apply plugin: 'com.android.library' //此句之后的为需要增加的内容 apply plugin: 'com.github.dcendents.android-maven' group = '你的github账号' version = '1.0'
3.然后将项目发布到github
4.上github找到该项目,创建release
5.打开jitpack网址点击打开链接,输入你的项目地址,然后点击Get it,查看how to中的内容就是发布成功后的添加依赖的使用方法,如图