androidstudio上传自己的lib到Jcenter

rootproject的build.gradle添加依赖

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.novoda:bintray-release:0.9'//添加
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url = "http://variable-android.s3-website-us-east-1.amazonaws.com/release" }
        maven { url = "https://dl.bintray.com/rximage-ytf91/rximage/" }//最后一步添加,用于上传后审核中无法引用的问题
    }
}

allprojects {
    tasks.withType(Javadoc) {
        options.addStringOption('Xdoclint:none', '-quiet')
        options.addStringOption('encoding', 'UTF-8')//添加
    }
}

lib中build.gradle

apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release' // 添加


android {
 

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {

    implementation 'com.blissyang:rximage:1.0.0'//自己的远程仓库
}


publish {
    userOrg = 'rximage-ytf91'             // 组织名
    repoName = 'rximage'          // Binary上的刚才新建的仓库名(Repository)
    groupId = 'com.blissyang'        // 依赖名compile 'x:y:z'中的包名x
    artifactId = 'rximage'        // 依赖名compile 'x:y:z'中的项目名y
    publishVersion = '1.0.0'          // 依赖名compile 'x:y:z'中的版本号z
    desc = 'Non intrusive frame'            // 对该开源组件的说明
    website = 'https://github.com/yangtianfu2018/'  // VCS地址,即填写项目上传的Github地址
}

上传命令

Terminal中输入命令 ,其中blissyang91是你的 Bintary账号,PbintrayKey是你的api key,首页右上角点击用户名选项下的"Your Profile"进入个人主页,然后点击用户名下面的Edit进入个人信息编辑页面,接下来点击页面左边列表的最后一项API Key

gradlew clean build bintrayUpload -PbintrayUser=blissyang91 -PbintrayKey=f0aa015bee99138365b63b5e26a0a594020f347d -PdryRun=false

效果图

androidstudio上传自己的lib到Jcenter

androidstudio上传自己的lib到Jcenter