记录一次完整的Android Library到jcenter的过程

来源:互联网 发布:淘宝鹰眼 编辑:程序博客网 时间:2024/04/30 03:55

一,本地代码如何快速上传到github上

1,首先需要在github上创建一个仓库


2,初始化本地git环境

git init  git addgit commit -m "commit info"

3,本地代码提交到github上

git remote add origin git@github.com:xdhywj/commonmenu.gitgit push -u origin mastergit pull origin master

二,如何将代码打包到jcenter上

1,注册bintray账号

一定是这个个人账号注册地址:https://bintray.com/signup/oss,而不是直接搜bintray,然后进入注册,如下图所示


2,创建仓库


3,获取bintray帐号的Key


4,配置本地android代码

工程的build.gradle中增加对Bintray的依赖


对library的build.gradle增加如下代码



对各个字段的说明:
publish {    userOrg = 'xdhywj' //用户名    groupId = 'com.xdhywj.commonmenu' // jcenter上的路径    artifactId = 'commonmenu' //项目名称    version = '0.0.1'  //版本号    description = 'Super duper easy way to release your Android and other artifacts to bintray'  //描述    website = "https://github.com/xdhywj/commonmenu"  //github地址}

5,将aar上传到jecenter

./gradlew clean build bintrayUpload -PbintrayUser=*****(userOrg) -PbintrayKey=***** -PdryRun=false

6,遇到的问题

lint错误
解决办法
工程的build.gradle和library的build.gradle增加如下代码:
lintOptions {        abortOnError false    }



注释错误
解决办法:一个个的修改吧

其他错误,可以参照下面的参考文章中有介绍。

三,参考文章

http://blog.csdn.net/jiayite/article/details/50603419

http://blog.csdn.net/yang123465/article/details/54972351

0 0