发布aar到Github
第一步:
创建GIthub账号,账号不会创建的,哥也帮不了你,只能自行了断了。
第二步:
在Github创建仓库
看图跟着学,高手略过。



第三步:
电脑上安装Git 并且配置key(这里就不讲述怎么配置了,度娘都有)
如果大家需要,我抽时间补上这个步骤,好不?
第四部:
克隆Git仓库到本地
1.在电脑本第创建文件夹
这是我自己的。

2.打开Git 输入命令:cd \f\arr\yinshiping 回车 进入新建的文件下

2.将本地仓库初始化,命令:git init 如下图

3.将你需要的项目从github或者服务器上克隆下来,命令:git clone url url为项目服务器地址或github地址,这里我们克隆刚才在github新建的那个仓库地址
点击下图红色标记处,可把地址复制下来。


看到上面显示100%就克隆好了 现在看看克隆的项目
成功后会在刚才本地新建的文件夹下看到两个这个的文件

第五步:
打开你的as 找到你要生成arr 的library 在 library 下的build.gradle末尾添加以下代码:
applyplugin:'maven'
ext {
// 从Github上clone下来的项目的本地地址
GITHUB_REPO_PATH ="F:\\arr\\yinshiping\\yinshipin"
PUBLISH_GROUP_ID ='com.yuxihai' //这个不要跟着我写 这是github 的id
PUBLISH_ARTIFACT_ID ='yinshipin' //这个是刚才在github创建的仓库名字
PUBLISH_VERSION ='1.0.0' //版本号
}
uploadArchives {
repositories.mavenDeployer {
def deployPath = file(project.GITHUB_REPO_PATH)
repository(url:"file://${deployPath.absolutePath}")
pom.project {
groupId project.PUBLISH_GROUP_ID
artifactId project.PUBLISH_ARTIFACT_ID
version project.PUBLISH_VERSION
}
}
}
// 源代码一起打包(不需要打包源代码的不要添加这几行)
task androidSourcesJar(type: Jar) {
classifier ='sources'
from android.sourceSets.main.java.sourceFiles
}
artifacts {
archivesandroidSourcesJar
}
第六步:
打包上传
看图操作

输入命令:gradlew uploadArchives 回车执行
出现绿色的地方 表示成功

本地文件下多出来一个文件如图

上传自己的项目到github上
大致可以分为四步add,commit,remote,push
add(选择在仓库里将要添加的文件)
$ gitadd. //(.代表要上传此文件夹内所有的文件。如果需要上传指定文件,指定文件名称就可以)
如图:

commit
$ git commit -m 'Test'//(m后面跟一个参数,表示说明,将代码提交到GitHub后,将会在代码文件信息上显示这个说明,这个很重要)

remote
$ git remoteaddorigin URL //主义URL替换成自己github仓库地址
有时候输入这个语句的时候,github可能会”掉线”。会报fatal: remote origin already exists.这个错误。这时只需要输入
$ git remote rm origin 再输入上面的代码就可以了

最后一步push
$ git push-uorigin master//将本地项目更新到github项目上去


最后使用:
第一种:

再加上:compile 'com.github.yuxihai:yinshipin:V1.0.0'
第二种:
还是看图吧





打开:https://jitpack.io/


最后使用方式:

好了写完了 不明白的可以评论或者私信,大家一起学习,努力成为顶级大神!