Android Studio 上传库至Bintary JCenter 流程

  1. 注册账号  地址:https://bintray.com/  可用第三方登录(github)
  2. 在个人资料里找到API Key 保存下,之后上传有用
  3. 新建 Maven Repositor 和Package
  4. 在项目 root gradle 添加插件
    classpath 'com.novoda:bintray-release:0.8.0'
    novoda 是个第三方库 更简洁 地址:https://github.com/novoda/bintray-release
  5. 在需要上传的modul的build 添加  
    def siteUrl = 'https://github.com/hjk6688/git.git'
    publish{
        repoName = 'Victory'//远程仓库名字,不指明,默认是上传到maven
        userOrg = 'hjk6688'//bintray.com的用户名
        groupId = 'com.huangjingkai'//jcenter上的路径 以后引用的话 implemetation 'com.huangjingkai.empty:1.0.0'
        artifactId = 'empty'//项目名称
        publishVersion = '1.0.0'//版本号
        desc = '空的项目'//描述,不重要
        website = siteUrl//项目主页
    }  
  6. 执行脚本

     ./gradlew clean build bintrayUpload 
     -PbintrayUser=hjk6688  // 用户名
     -PbintrayKey=xxxxxxxxxxxxxxxxxxxxxx   // 之前存的api key
     -PdryRun=false  // 若为true 执行完成单不上传
  7. 去https://bintray.com/用户名/仓库名/ 下Add to JCenter  等待审核过后即可使用

其实碰到的问题:

1. Unable to load class ‘org.gradle.api.internal.component.Usage   

解决方法: 升高novoda 库的版本

2. Unable to load class ‘org.gradle.api.internal.component.Usage

解决方法: 降低build 的版本

3. 防止乱码

tasks.withType(Javadoc) {//防止编码问题
    options.addStringOption('Xdoclint:none', '-quiet')
    options.addStringOption('encoding', 'UTF-8')
    options.addStringOption('charSet', 'UTF-8')
}

4.Error:Could not determine java version from '9.0.4'

切换jdk 版本


我上传成功最终的配置:

novoda 0.8  

jdk9 

build 4.4 build tool 3.1.0







猜你喜欢

转载自blog.csdn.net/hxz6688/article/details/80021249