第一次玩这个 ,真的挺难受的

先注册,  地址:https://bintray.com

选免费账户注册

jcenter使用小结_上传

第二步

新建responsity

jcenter使用小结_上传_02

进去之后add new package 关注2个地方

  1.是 name必须是你想上传的module名字

  2.  设置git地址,我这边是吧项目先上传到github,然后release一下

jcenter使用小结_上传_03

jcenter使用小结_上传_04

 

然后看下android  studio 配置

整个项目包括一个app主工程和baselibrary 2部分

jcenter使用小结_根目录_05

先看app中配置

主工程的gradle其实没什么配置 我就添加个baselibrary的依赖

jcenter使用小结_上传_06

 

 baselibrary中配置

jcenter使用小结_上传_07

jcenter使用小结_maven_08

 

最后是根目录的gradle配置 

添加依赖

classpath "com.novoda:bintray-release:0.9.1"

设置编码

jcenter使用小结_上传_09

jcenter使用小结_maven_10

 

 配置完之后在terminal中输入上传命令  ,这个PbintrayKey   在 edit profile中

gradlew clean build bintrayUpload -PbintrayUser=13701719653 -PbintrayKey=XXXX -PdryRun=false
 

jcenter使用小结_上传_11

 

上传成功之后

最后 到自己的package中 add to jcenter

 

提交成功之后,jcenter工作人员审核要时间的,所以用maven方式可以先测一下

这个设置成maven的url,配置在项目的根目录中

jcenter使用小结_上传_12

 

jcenter使用小结_maven_13

 然后在app的gradle中 把库工程依赖换成 maven依赖

 

jcenter使用小结_maven_14

 这里拼接方式说下  implementation "groupId:artifactId:publishVersion" 根据之前baselibrary中的publish配置决定

运行一下 能跑说明成功了.

大概过了几分钟 ,审核就给我通过了.

jcenter使用小结_maven_15

这时候可以把

maven{url "https://dl.bintray.com/13701719653/maven"}

这行删掉了. 

大功告成.!!!!

中间遇到一些问题

1. upload的时候一直卡99%

建议切手机流量上传

 

2.第二个是上传时候报404

建Repositories的时候 名字一定要填maven , 否则就删掉重新创建.

 

3.命名工程的时候别带test,不然人家以为你不是正儿八经发布的,工作人员还询问我到底是不是release版.经过一波抠脚英语解释,他才给我上传成功