向jcenter提交library的之无坑版(无坑有效期:暂定2017年底)

来源:互联网 发布:手机淘宝哪里实名认证 编辑:程序博客网 时间:2024/06/05 23:58

第一步:登录Bintray官网

第二步:注册(坑一:点击sign up here,千万不要点击绿色的大按钮,否则掉坑里了;坑二:注册的邮箱qq和网易都不行,outlook可以)


第三步:点击edit


第四步:点击key


第五步:输入登录密码


第六步:点击这货(复制按钮),把它暂时存到随便一个txt文档中


第七步:点击创建一个仓库


第八步:按照我写的输入,然后点击create


第九步:打开android studio新建一个module library(别告诉我你不会)

第十步:打开Project的build.gradle,加入如下代码

classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'

坑:注意下面两张图片的区别,一个是名称要全,一个是版本要高,按我的复制就好,我也是被坑过了

下面这张是网上教程之有坑版


下面这张是网上教程之无坑版



第十一步:打开module library的build.gradle,添加如下代码,有注释的部分是需要你改的部分,然后按照下面的图片对应复制

apply plugin: 'com.github.dcendents.android-maven'apply plugin: 'com.jfrog.bintray'version = "1.0.0"resourcePrefix "hjkkl"
def siteUrl = 'https://github.com/Superluzhan/Second'      // 需要你在github上新建一个仓库,项目的主页def gitUrl = 'https://github.com/Superluzhan/Second.git'   // Git仓库的urlgroup = "com.example.supertoast" // Maven Group ID for the artifact,一般填你唯一的包名install {    repositories.mavenInstaller {        // This generates POM.xml with proper parameters        pom {            project {                packaging 'aar'                // Add your description here                name 'Android Commonly used utils'  //项目描述                url siteUrl                // Set your license                licenses {                    license {                        name 'The Apache Software License, Version 2.0'                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'                    }                }                developers {                    developer {                        id 'saymagic'                               name 'publicluzhan' //你的登录Bintray用户名                        email 'privateluzhan@outlook.com' //你注册Bintray时的邮箱                    }                }                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"  //发布到Bintray的那个仓库里,与刚才我们新建的仓库名字一致        name = "utils"  //发布到Bintray上的项目名字        websiteUrl = siteUrl        vcsUrl = gitUrl        licenses = ["Apache-2.0"]        publish = true    }}

def siteUrl = 'https://github.com/Superluzhan/Second'      // 需要你在github上新建一个仓库,项目的主页如下

def gitUrl = 'https://github.com/Superluzhan/Second.git'   // Git仓库的url



截图工具不给力,反正就是一直到底了

第十二步:打开项目的local.properties加入以下两句,配置搞定,点击同步(sync),不报错就往下走

  bintray.user=your_user_name //修改为你的用户名  bintray.apikey=your_apikey //修改为你的刚才暂时保存的key


第十三步:打开studio自带的命令行窗口

第十四步:输入如下后回车


第十五步:等待吧,如果最后显示succeful,那么继续输入如下后再回车


第十六步:等待吧,如果最后显示succeful,那么大功告成!

第十七步:进入bintray官网,看是不是提交上去了library


第十八步:打开这个library,然后点击add to jcenter,然后会又弹出一个页面,直接发送就行,什么也不用填写


第十九步:等待吧,漫长的等待,大约一两个小时,官网会给你应答,收到应答后如下图(有新邮件!)


第二十步:可以使用了,相信你已经跃跃欲试了,如下图,再打开你的仓库,点击这货,就会出现你熟悉的面孔!


第二十一步:尽情使用吧!

0 0
原创粉丝点击