AndroidStudio上传Library到JCenter
来源:互联网 发布:amarra for mac 编辑:程序博客网 时间:2024/05/28 17:05
本文不做过多描述,以我个人的utils library上传为例,直接列举操作步骤:
注册bintray账号
网址:https://bintray.com/signup/oss
注:可通过Github、Google、Twitter授权bintray实现注册
创建bintray仓库
网址:https://bintray.com/profile/edit
操作步骤:
- 点击左侧“Repositories”选项,
- 点击该选项右侧“New Repository”按钮,
- 填写Name选项框的值为“maven”,
- 选择Type选项框的值为“Maven”,
- 点击“Create”按钮。
注意:Name选项框的值maven
必须是小写。
配置gradle参数
配置Project的build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files classpath 'com.novoda:bintray-release:0.3.4' // 新增 }}allprojects { repositories { jcenter() }}task clean(type: Delete) { delete rootProject.buildDir}
配置Library项目的build.gradle
apply plugin: 'com.android.library'apply plugin: 'com.novoda.bintray-release' // 新增android { ...}dependencies { ...}publish { // 新增 userOrg = 'fqxyi' // 注册bintray时的username groupId = 'com.fqxyi.utils' // 项目包名 artifactId = 'utils' // 项目名 publishVersion = '1.0.0' // 发布版本号 desc = 'Summarize the tools or methods commonly used in routine development' // 项目描述,可选项 website = 'https://github.com/fengqingxiuyi/AndroidUtils' // 项目站点,可选项}
执行上传命令
命令:
./gradlew clean build bintrayUpload -PbintrayUser=username -PbintrayKey=API Key -PdryRun=false
命令解释:
- PbintrayUser的值为注册bintray时的username,
- PbintrayKey的值为bintray的Api Key,可从https://bintray.com/profile/edit网址左侧的
API Key
选项中得到, - PdryRun是一个配置参数,当为true时,表示会运行所有环节,但不会上传。–该句摘自网络,尚未理解
申请添加到JCenter
网址:https://bintray.com/username/maven/artifactId
注意:
- 网址中的username需要更换为注册bintray时的username,
- 网址中的artifactId需要更换为项目名。
操作步骤:
- 点击右下角的“Add to jcenter”按钮添加library package到jcenter,会跳转到https://bintray.com/message/addPackageToJCenter?pkgPath=/fqxyi/maven/utils网址,
- 点击“Send”按钮发送请求。
检测是否申请通过
访问https://jcenter.bintray.com/groupId/artifactId/publishVersion网址,如果能看到以下四个文件即表示申请通过:
artifactId-publishVersion-javadoc.jarartifactId-publishVersion-sources.jarartifactId-publishVersion.aarartifactId-publishVersion.pom
注意:网址中的groupId,默认是项目包名,在其成为网址的一部分后,需要将.
符号改为/
符号,例如:https://jcenter.bintray.com/com/fqxyi/utils/utils/1.0.0/
FAQ
Repo ‘maven’ was not found
问题:
* What went wrong:Execution failed for task ':androidutilslibrary:bintrayUpload'. > Could not create package 'fqxyi/maven/androidutilslibrary': HTTP/1.1 404 Not Found [message:Repo 'maven' was not found]
解决:未创建仓库 或 仓库名写错,注意maven是小写
Lint检查报错
问题:Lint检查报错,导致Build & Upload失败
解决:
方式一:需要自行根据错误信息修正Error级别的问题,
方式二:为Library项目的build.gradle配置以下Lint选项实现,–该方式摘自网络,未验证:
android { ... lintOptions { abortOnError false // 即使有报错也不会停止打包 checkReleaseBuilds false // 打包Release版本的时候也不进行Lint检测 } ...}
网络问题导致的上传失败
问题:
* What went wrong:Execution failed for task ':utils:bintrayUpload'.> javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
* What went wrong:Execution failed for task ':utils:bintrayUpload'.> org.apache.http.conn.HttpHostConnectException: Connection to http://127.0.0.1:8888 refused
* What went wrong:Execution failed for task ':utils:bintrayUpload'.> org.apache.http.NoHttpResponseException: The target server failed to respond
解决:
步骤1:关闭代理软件,重启网络;
步骤2:关闭由上传操作自动开启的Java客户端(Mac上会出现,其他设备不清楚)
阅读全文
0 0
- AndroidStudio上传Library到JCenter
- Android library上传到jcenter
- 将Library上传到Jcenter
- 将Library上传到Jcenter
- 上传 Android library 到 Jcenter
- Android 上传library到jcenter
- AndroidStudio上传项目到Bintray jCenter
- Android Studio 将Library 上传到 Jcenter
- Android Library上传到JCenter仓库实践
- Android Studio 上传aar(Library)到JCenter
- 如何使用AndroidStudio将开源项目library发布到jcenter
- AndroidStudio上传自己的项目到Bintray jCenter远程仓库!
- AndroidStudio上传自己的项目到Bintray jCenter远程仓库!
- Android Studio中快速将Library上传到JCenter
- 如何开发自己的library上传到jcenter
- 新版Bintray-极简上传Library到JCenter
- Mac Android Studio将项目(library)上传到jcenter
- 新版Bintray-极简上传Library到JCenter
- JSP中四种传递参数的方法
- Http中 Post和 Get的区别
- EventBus模版
- 洛谷 P2570 [ZJOI2010]贪吃的老鼠
- CCPC FINAL 2017
- AndroidStudio上传Library到JCenter
- Android Retrofit的使和封装
- Codejam之Ratatouille
- ESP32 Linux开发环境搭建
- 数据结构之树的操作
- Atitit 人工智能目前的进展与未来 包含的技术 v3
- python 统计序列中元素的出现频度\统计英文文章的词频
- codeforces #422 C. Hacker, pack your bags!(贪心dp)
- 利用ScriptEngineManager实现字符串公式灵活计算