Gradle上传 aar到JCenter

只说明一些注意事项 ,其他细节可以参考  http://blog.csdn.net/ls1110924/article/details/46470059,也可以直接参考我的项目 https://github.com/wfxphoebus/Coke-Android

1、在项目总的build.gradle 文件中添加下面两行代码


classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'

 
  

Gradle上传 aar到JCenter_第1张图片

2、在要上传的module的build.gradle 文件里添加一行代码

apply from: 'https://raw.githubusercontent.com/wfxphoebus/JCenter/master/bintray.gradle'

 
  

说明一下这里:这个把上传到JCenter的公共不变的代码抽出来,方便可以直接用于其他的项目,也减少本地gradle 文件的代码量,上面的地址是我的个人的github地址项目https://github.com/wfxphoebus/JCenter,可以可以拿来直接用,当然也可以fork为自己的再用。

怎么生成这个地址:直接上图,点击如图的按钮即可

Gradle上传 aar到JCenter_第2张图片

3、在要上传的module项目添加gradle.properties文件


PROJ_GROUP=com.coke.android
PROJ_VERSION=0.0.1
PROJ_NAME=Coke
PROJ_WEBSITEURL=https://github.com/wfxphoebus/Coke-Android.git
PROJ_ISSUETRACKERURL=https://github.com/wfxphoebus/Coke-Android/issues
PROJ_VCSURL=https://github.com/wfxphoebus/Coke-Android.git
PROJ_DESCRIPTION=A Simple Library For Android
PROJ_ARTIFACTID=Coke

LICENSE_NAME='The Apache Software License, Version 2.0'
LICENSE_URL='http://www.apache.org/licenses/LICENSE-2.0.txt'

DEVELOPER_ID=springwater
DEVELOPER_NAME=SpringWater
DEVELOPER_EMAIL=[email protected]


4、在第一张里所示的local.properties,添加 bintray.apikey 和 bintray.user


大功告成!

你可能感兴趣的:(android)