在Jitpack.io中發(fā)布Android Library
0. 如果工程的gradle版本是3.*的污呼,需要在root build.gradle中添加
buildscript {
dependencies {
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' // Add this line
需要在你的library/build.gradle 中增加
apply plugin: 'com.github.dcendents.android-maven'
group='com.github.YourUsername'
參考文檔:https://jitpack.io/docs/ANDROID/
1. 需要一個(gè)github的賬號(hào)
jitpack.io會(huì)從github中加載你賬號(hào)下的工程末早,所以先要有g(shù)ithub賬號(hào)寨昙,然后在jitpack.io中用github賬號(hào)進(jìn)行登錄司澎。
2. 在jitpack中填寫工程的地址午绳,然后look up
我的工程地址是:https://github.com/jijunpeng/android-utils
只要填寫jijunpeng/android-utils
癌佩,然后lookup碌嘀。接著點(diǎn)擊Get it
杜跷,之后會(huì)在網(wǎng)頁下方告訴你怎么集成到其他工程中傍念。
Paste_Image.png
3. 工程設(shè)置重點(diǎn)
1.提交到github上的setting.gradle文件只保留你要發(fā)布的那個(gè)library module就可以,不要寫其他module葛闷。例如:
Paste_Image.png
4. 給發(fā)布的包添加版本號(hào)
普通提交上去的Android library的引用可能是這樣:
compile 'com.github.jijunpeng:android-utils:e44164cdb9'
現(xiàn)在想這樣引用
compile 'com.github.jijunpeng:android-utils:1.0.0
那么需要做的工作就是在github上發(fā)布你的工程的release版本
Paste_Image.png
然后在jitpack.io中點(diǎn)擊release Get it
你需要發(fā)布的版本就可以了
Paste_Image.png