Android之发布项目至jcenter
2016-08-09 07:27
316 查看
本文主要记录一些零碎的东西
把这篇文章中的项目发布到仓库,这个我也是头一次,查了好些,但是好多人的都说不清楚,反正作为一个新手的我看着挺乱
整理整理流程:
1 .先去注册一个账户:https://bintray.com (jcenter的代码仓库),我选的第三方登录
2. 登录后啥都不需要做,找了一个配置特别简单的类库
novoda/bintray-release : https://github.com/novoda/bintray-release
3. 找一下自己的key,点击用户名进去就可以看见,后面需要用到
4.回到Android Studio,项目的build.gradle文件(不是module的),新增
要上传的module的build.gradle文件
点击底部的Terminal即可输入命令来上传
user就是用户名,key就是我们刚才的让你保存的key,dryRun是一个配置参数,当为true的时候,会运行所有的环节,但是不会上传。
我的注释是使用的中文,上传是报错了,编码不一样,一个GBK,一个UTF8,没有找到好的方案解决,删注释咯
然后重新上传,成功后回到网站上,等一会儿刷新一下,会发现出来项目了,默认在maven仓库下
接下来就是添加到jCenter,点击你的项目进去,如我的 progressbar,然后一个按钮就好
随便填一下,就等那边审核通过吧,过了会发邮件提示,时间不一定,至少一个小时,通过了会给你邮件提醒
成功后
成功后在需要的项目里的build.gradle 文件里dependencies添加依赖就可以使用了
是不是看着就特别简单,主要是前人都给我们做好了
把这篇文章中的项目发布到仓库,这个我也是头一次,查了好些,但是好多人的都说不清楚,反正作为一个新手的我看着挺乱
整理整理流程:
1 .先去注册一个账户:https://bintray.com (jcenter的代码仓库),我选的第三方登录
2. 登录后啥都不需要做,找了一个配置特别简单的类库
novoda/bintray-release : https://github.com/novoda/bintray-release
3. 找一下自己的key,点击用户名进去就可以看见,后面需要用到
4.回到Android Studio,项目的build.gradle文件(不是module的),新增
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.1.2' // upload jcenter needs classpath 'com.novoda:bintray-release:0.3.4' } }
要上传的module的build.gradle文件
apply plugin: 'com.android.library' apply plugin: 'com.novoda.bintray-release'//添加 android { compileSdkVersion 24 buildToolsVersion "24.0.0" defaultConfig { minSdkVersion 15 targetSdkVersion 24 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:24.0.0' } //添加 publish { userOrg = 'cl-window'//bintray.com用户名 groupId = 'com.cl.slack'//jcenter上的路径,一般填你唯一的包名 artifactId = 'progressbar'//项目名称 publishVersion = '1.0.0'//版本号 desc = 'progressbar segment color'//描述,不重要 website = 'https://github.com/CL-window/progressBar'//网站,不重要;尽量模拟github上的地址 }
点击底部的Terminal即可输入命令来上传
windows: gradlew clean build bintrayUpload -PbintrayUser=cl-window -PbintrayKey=**********...***** mac / linux : ./gradlew clean build bintrayUpload -PbintrayUser=cl-window -PbintrayKey=**********...***** -PdryRun=false
user就是用户名,key就是我们刚才的让你保存的key,dryRun是一个配置参数,当为true的时候,会运行所有的环节,但是不会上传。
我的注释是使用的中文,上传是报错了,编码不一样,一个GBK,一个UTF8,没有找到好的方案解决,删注释咯
然后重新上传,成功后回到网站上,等一会儿刷新一下,会发现出来项目了,默认在maven仓库下
接下来就是添加到jCenter,点击你的项目进去,如我的 progressbar,然后一个按钮就好
随便填一下,就等那边审核通过吧,过了会发邮件提示,时间不一定,至少一个小时,通过了会给你邮件提醒
成功后
成功后在需要的项目里的build.gradle 文件里dependencies添加依赖就可以使用了
是不是看着就特别简单,主要是前人都给我们做好了
相关文章推荐
- Android studio 使用Gradle发布Android开源项目到JCenter 总结
- Android拓展系列(12)--使用Gradle发布aar项目到JCenter仓库
- Android 发布项目到jcenter
- 使用Gradle发布Android开源项目到JCenter
- 使用Gradle发布Android开源项目到JCenter
- 将Android开源项目通过Gradle发布到bintray/Jcenter
- Android 发布项目到 JCenter 遇到的各种坑
- Android拓展系列(12)--使用Gradle发布aar项目到JCenter仓库
- 将Android项目发布到Jcenter
- Android 发布开源项目到jcenter
- Android 发布项目到 jcenter 遇到的坑
- Android拓展系列(12)--使用Gradle发布aar项目到JCenter仓库
- 一起来学Android Studio:(六)使用Gradle发布Android开源项目到JCenter
- Android studio 发布Android Library项目到JCenter
- Android 发布Android Library项目到JCenter