为之于未有,治之于未乱。
Publish an Android library
In order to publish your Android library on JitPack you just need a working build file in your Git repository.
Android SDK is available in the build environment and ANDROID_HOME variable is already set when the build starts. Builds are run with Java 8 by default but can be configured using a jitpack.yml file.
Gradle
To enable building on JitPack you need to add the android-maven plugin.
If using Gradle 3.0 or later:
In your root build.gradle:
123dependencies {classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'}In your library/build.gradle add:
12apply plugin: 'com.github.dcendents.android-maven'group='com.github.YourUsername'Create a GitHub release or add a git tag.
Remark:
Publish the project to Github and release it to the public repository

Get the JitPack repository address

Installing
Users of your library will need add the jitpack.io repository:
123456allprojects {repositories {jcenter()maven { url "https://jitpack.io" }}}And
123dependencies {compile 'com.github.jitpack:android-example:1.0.1'}
Note: do not add the jitpack.io repository under build script