Git Jitpick github/gitee码云 创建自己的
今天说一下我平时使用的依赖 library 本文介绍的并不是 library Module 而是 compile: 'library'
如何创建 library 呢 现在主流的有三种方式 由于时间原因 今天说一下最快捷的一种方式 JItPick + Git 的方式 其他两种后续更新 JitPick 是一种远程制作工具 将远程Git库打包成library 使用起来也很简单 具体操作看下文介绍
首先我们说一下我们所需要的工具 git , github/gitee(码云)托管工具(托管工具必须注册) 还有你的ide( 本文以AS 为例) 然后就是JitPick(非必须注册)
点击注册 gitee(码云) 注册
点击注册github点击注册
点击注册JitPick点击注册
首先看一下效果

好 接下来就是具体操作了
首先我们登陆github/gitee(码云) 创建一个仓库 图例


创建个公开的项目 然后使用git clone 到本地

然后使用as 创建project 工程目录选择你clone的目录

project 创建完成后 创建module

创建完成后 开始配置这个library
首先配置 project 的 build.gradle
dependencies {
...
classpath'com.github.dcendents:android-maven-gradle-plugin:1.5' // 加入行
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
再配置 module 的 build.gradle
applyplugin:'com.github.dcendents.android-maven'
group='com.gitee.nade_s' // 使用github(group = 'com.github.你的github昵称')时这一行可有可无 使用码云时要加上
配好以后同步一下工程
然后开始编码你的功能代码
这里是测试
public class Rxutils {
// test
public static final Stringrx ="我是正则";
}
test 代码 供外部调用
然后将代码托管到git (github/gitee) 本文以gitee为例
先添加去掉一些不必要的文件
file --> settings --> version Control ---->Ignored files 添加你要忽略的文件和文件夹
你要忽略的是 所有的.iml;local.properties ;所有的.idea文件夹 所有的.gradle文件夹 所有的build文件夹
添加好忽略文件以后 开始上传到gitee 关于gitee的使用不会的 可以私信我 在这里就不多说了
如果报错 Push rejected: Gitutils: push to origin/master was rejected 点这里解决git错误
gitee 上传成功后 开始创建发行版 点击你的项目 点击发行版

点击发行版 创建发行版


创建完成后 复制链接

然后去Jitpick 进行打包

点击获取 get it build成功后

完成制作后 开始实用就好了 根据提示添加 在新建工程的build.gralde 的allprojects{ repositories{ // 添加 maven{url 'https://jitpack.io'}}} 然后在module 的 build.gradle 中添加 compile'com.gitee.nade_s:MyLib:1.0.2' ;as3.0以后的版本也可以添加 implementation'com.gitee.nade_s:MyLib:1.0.2'
好 本文到此结束 欢迎留言