想不想把自己的库也上传到jcenter,然后只需要一名话 compile com.zzb.library:android-common:0.1.0 //(compile group_id:artifact_id:version)
就可以引用你的库? 按着下面的教程一步一步来就可以了
1.到https://bintray.com/注册一个账号
2.AndroidStudio创建一个项目,然后再在这个项目里创建一个library(File->New->New Module->Android Library)
3.打开项目根目录的gradle.properties文件,复制下面的内容,替换相应字段的值
VERSION_NAME=0.1.0 GROUP=com.zzb.library POM_NAME=jcenter test POM_ARTIFACT_ID=common POM_PACKAGING=aar #比如我们引用appcompat-v7,那么会这么写 compile 'com.android.support:appcompat-v7:22.2.0' #实际对应的字段就是 compile 'GROUP:POM_ARTIFACT_ID:VERSION_NAME' POM_DESCRIPTION=项目描述 #项目地址等,我这使用的是github的项目地址 POM_URL=https://github.com/BaronZ/android-common-library POM_SCM_URL=https://github.com/BaronZ/android-common-library POM_SCM_CONNECTION=scm:git:git://github.com/BaronZ/android-common-library.git POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/BaronZ/android-common-library.git #开源协议 POM_LICENCE_NAME=The Apache Software License, Version 2.0 POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt POM_LICENCE_DIST=repo POM_DEVELOPER_ID=zzb POM_DEVELOPER_NAME=ZZB POM_DEVELOPER_EMAIL=realbo89@outlook.com POM_DEVELOPER_URL=http://baronz.github.io GIT_URL=https://github.com/BaronZ/android-common-library.git ISSUE_URL=https://github.com/BaronZ/android-common-library/issues