当前位置:网站首页>Androd发布JitPack开源项目(gradle7.2)
Androd发布JitPack开源项目(gradle7.2)
2022-07-19 18:54:00 【莫翊痕】
记录一次发布JitPack依赖库全流程.
AndroidStudo版本:2021.1.1 Patch3
1.创建项目
项目名称自定义,这里为WLibrary
2.创建Library
2.1创建名字为WUtils的Android Library
2.2依赖创建的library
打开File ==>ProjectsStructure,注意选择框起来的label
3.配置项目
3.1工程根目录新建 jitpack.yml
before_install:
- sdk install java 11.0.10-open
- sdk use java 11.0.10-open
jdk:
- openjdk11
3.2WUtils模块的build.gradle加入以下选中代码
完整的build.gradle
plugins {
id 'com.android.library'
id 'maven-publish'
}
android {
compileSdk 31
defaultConfig {
minSdk 22
targetSdk 31
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
//依赖库组id
groupId = 'com.moyihen.w-library'
//单组件发布时随意填写,多组件时即为此组件的artifactId
artifactId = 'w-library'
}
}
}
}
4.提交代码到github
4.1验证git是否安装
确定已安装git,没有安装去官网下载,打开File =>Settings=>Version Control=>Git,点Test测试能正确找到安装路径,出现版本号为正常.
4.2点击GitHub 登录你的github账号
下面是正常登录状态.
4.3 提交代码
首次提交会默认创建仓库.点击Git=>Share Project on GitHub =>share=>Add
上传成功,点下方蓝色字体会跳转github上传地址.
5 创建发行版本
5.1 点击tags,
5.2 点击底部Publish release
5.3 发布完成,
6 关联JitPack
输入自己项目仓库地址,我的是https://github.com/moyihen/WLibrary,点击Look up =>点击Get it ,这样就关联发布成功了.往下滑有依赖 库使用方法.
7 测试依赖库是否发布成功.
grade7.0依赖有所变动.
7.1 打开项目settings.gradle,配置 maven { url ‘https://jitpack.io’ }
7.2 打开app=>build.gradle,
配置 implementation ‘com.github.moyihen:WLibrary:v1.0.0’
7.3 项目可正常依赖WLibrary,调用函数正常
end.
边栏推荐
- CodeBlocks download + interface optimization + create file + common shortcut keys
- Pytoch -- model reading and storage
- STM32F1与STM32CubeIDE编程实例-BMP280气压温度传感器驱动
- 物联网技术在物联网产业格局的分布与应用
- 1.57 亿:圳智慧·智慧交通管理服务应用平台项目
- 当我们谈论不可变基础设施时,我们在谈论什么
- 数据分析小案例:招聘数据可视化,查看领域最需技术~
- "Viewpager" and banner in compose
- Kubernetes 介绍
- Web3.0应用架构设计演化
猜你喜欢
数组、字符串、对象相关方法以及布尔值判断
"Viewpager" and banner in compose
Opencv learning materials sharing: Chinese, graphics and text, code notes are both abundant, and it is recommended to collect them
2D denseunet based brain glioma segmentation brats + paper translation + code implementation
1、图机器学习基础入门
CodeBlocks download + interface optimization + create file + common shortcut keys
中国地图上的60家AI制药企业
Custom attribute operation of DOM series
iNFTnews | 拥有99年历史的《TIME》正引领传统媒体进军NFT
iNFTnews | 音樂在Web3中的未來
随机推荐
Anfulai embedded weekly report no. 274: 2022.07.11--2022.07.17
STM32开发笔记120:解决printf中%f不能输出的问题
软测总监:“ 工作五年你连服务端接口测试还不知道?“
AUTOCAD——自定义特殊线型
银行业数据安全建设专题分析
软件测试岗位就业竞争压力大,985毕业的“打工人“同样存在苦不堪言。
36 亿元、对象存储市场:XSKY 7亿、华为 6.9亿、杉岩 4.6亿、新华三 3.6亿、浪潮 3.2亿、中移 3亿
三星Exynos 9820内核照片曝光:8nm工艺下面积大增,集成双核NPU!
Uniapp uses local storage to transfer values between pages
STM32F1与STM32CubeIDE编程实例-HMC5883电子罗盘驱动
Soft test director: "after five years of work, you don't even know about the server interface test“
Distribution and application of Internet of things technology in the industrial pattern of Internet of things
Pytoch -- model reading and storage
深圳某游戏研发公司给每个工位都装监控,网友:堪比坐牢!
iNFTnews | 音乐在Web3中的未来
3、3D点云基础入门——pointnet
The meaning of learning (I) the root cause of love problems comes from ignorance
Inftnews | time, with a 99 year history, is leading traditional media into NFT
Automatic picture switching (no transition effect)
GEE(7):GEE插件Open Earth Engine extension提高效率