JitPack.io
參考:
Android 寫自己的開源庫,發佈到 JitPack.io
JitPack官方文檔 上傳Android庫
示例:發佈ClearEditText到itPack.io
過程:
- 創建project,創建module(app+library),module library裏面有我們的ClearEditText
- 將項目發佈到github上,並設置realease
- 打開JitPack官網,輸入該項目的url,look up–>get it。
完成,按照瀏覽結果配置library。
詳細步驟
ClearEditTextLibrary是庫moludle
If using Gradle 3.0 or later:
(1) In your root build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' // Add this line
}
}
(2) In your library/build.gradle add:
apply plugin: 'com.github.dcendents.android-maven'
group='com.github.s1168805219'
其中s1168805219是我在github上的userName
(3) Create a GitHub release or add a git tag.
打開該project在github上的地址—>release–>create a new release–>填寫相應的信息即可
結果是:
(4)進入JitPack官網搜索你的庫,查看如何引用
搜索是輸入它的github上的url即可
Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
compile 'com.github.User:Repo:Tag'
}