lib建立及发布可以参考:http://www.jianshu.com/p/e443456bb506
下面简略说一下重点:
项目的build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
lib的build.gradle
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
group='com.github.amsterly'
amsterly为用户名 此demo地址
https://github.com/amsterly/MyJitPackDemo
编译并上传至github 跳转到release页面 添加初始版本 例如V1.0
打开https://jitpack.io/输入项目地址https://github.com/amsterly/MyJitPackDemo
获取依赖地址例如:
dependencies {
compile 'com.github.amsterly:MyJitPackDemo:v1.0'
}
你就可以在项目中使用了
再说一下升级 lib 修改完毕后 上传github 在release页面再发一个版本 例如v1.1
打开https://jitpack.io/输入项目地址https://github.com/amsterly/MyJitPackDemo
获取v.1.的依赖地址
dependencies {
compile 'com.github.amsterly:MyJitPackDemo:v1.1'
}
在项目中引用