首页 > 学院 > 开发设计 > 正文

欢迎使用CSDN-markdown编辑器

2019-11-09 16:11:01
字体:
来源:转载
供稿:网友

Android 发布项目到JitPack

标签(空格分隔): JitPack Android


关于JitPack

JitPack官网的介绍是这样的:

Easy to use package repository for Git Publish your JVM and Android libraries

引入JitPack到项目中

1.在项目的根目录的builde.gradle文件添加dependencies

classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'

2.在项目的根目录的builde.gradle文件添加repositories

maven { url "https://jitpack.io" }

buidle.gradle 文件代码如下:

buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.3' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' }}allPRojects { repositories { jcenter() maven { url "https://jitpack.io" } }}

3.在需要上传的Library Module 里面的buile.gradle中添加:

apply plugin: 'com.github.dcendents.android-maven'

buidle.gradle 代码如下:

apply plugin: 'com.android.library'apply plugin: 'com.github.dcendents.android-maven'android { compileSdkVersion 25 buildToolsVersion "25.0.0" defaultConfig { minSdkVersion 14 targetSdkVersion 25 versionCode 44 versionName "4.0.4" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }}dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:support-v4:25.0.0'}

发布项目

在添加好JitPack配置后,我们将代码提交到github上,点击项目的release,发布一个新的release

获取引用方式

打开JitPack官网 https://jitpack.io/,我们可以用github账号进行登录。 输入github地址,点击Look up 即可获取


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表