注册账号 在https://bintray.com/
上注册一个账号。可直接以github账号直接登陆
API Key [账号]>Your Profile>Edit>API Key>Show,记录自己的Key
工程添加JCenter配置
1 2 3 4 5 6 7 dependencies { classpath 'com.android.tools.build:gradle:2.0.0-alpha2' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 apply plugin: 'com.android.library' apply plugin: 'com.github.dcendents.android-maven' apply plugin: 'com.jfrog.bintray' version = "1.0.1" ### android { compileSdkVersion 23 buildToolsVersion "23.0.2" resourcePrefix "touchcircleprogress__" defaultConfig { minSdkVersion 15 targetSdkVersion 23 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:23.1.1' } def siteUrl = 'https://github.com/xuie0000/TouchCircleProgress' ###def gitUrl = 'https://github.com/xuie0000/TouchCircleProgress.git' ###group = "com.xuie" ###install { repositories .mavenInstaller { pom { project { packaging 'aar' name 'Android Touchable Circle Progress' ### url siteUrl licenses { license { name 'The Apache Software License, Version 2.0' url 'http://www.apache.org/licenses/LICENSE-2.0.txt' } } developers { developer { id 'xuie0000' ### name 'xuie' ### email 'xuie00000@gmail.com' ### } } scm { connection gitUrl developerConnection gitUrl url siteUrl } } } } } task sourcesJar(type: Jar) { from android.sourceSets .main.java.srcDirs classifier = 'sources' } task javadoc(type: Javadoc) { source = android.sourceSets .main.java.srcDirs classpath += project .files(android.getBootClasspath().join (File .pathSeparator)) } task javadocJar(type: Jar, dependsOn: javadoc) { classifier = 'javadoc' from javadoc.destinationDir } artifacts { archives javadocJar archives sourcesJar } Properties properties = new Properties() properties.load(project .rootProject.file ('local.properties' ).newDataInputStream()) bintray { user = properties.getProperty("bintray.user" ) key = properties.getProperty("bintray.apikey" ) configurations = ['archives' ] pkg { repo = "maven" name = "circleprogress" ### websiteUrl = siteUrl vcsUrl = gitUrl licenses = ["Apache-2.0" ] publish = true } }
local.properties增加1 2 bintray.user=[账户名称] ### bintray.apikey=xxxxxx ###
生成库
命令
gradle install
gradle bintrayUpload
快捷键
右侧Gradle>[library]>other>install
右侧Gradle>[library]>publishing>bintrayUpload
当首次提交项目时(后面升级不再需要)
进入项目页,如:https://bintray.com/xuie0000/maven/touchablecircleprogress/view
右侧中间,能够看到项Maven Central ,鼠标轻放在上面,会显示一串字,点击后面的Click here to get it include.
进入填写一些资料信息,过一会时间,就会显示成功了,具体效果,你再次点击Maven Central字样时,变成提示Sync version 1.0.0 to Maven Central ,没关系,发现不能用,就一直点它。。。
注意 版本升级时,只需要修改版本号,不修改group和model,否则会不成功