Android之JitPack快速发布开源库

为之于未有,治之于未乱。

JitPack
JitPack Documentation

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:
dependencies {  
    classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
}
  • In your library/build.gradle add:
apply 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

    release.png
  • Get the JitPack repository address

    look up.png

Installing

  • Users of your library will need add the jitpack.io repository:
allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}
  • And
dependencies {
    compile 'com.github.jitpack:android-example:1.0.1'
}

Note: do not add the jitpack.io repository under build script

Demo

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容