教你把本身Adnroid代碼上傳到JCenter

##上傳項目到JCenterjava

//引用方式以下
compile '項目組ID:項目名稱:項目版本號'

//引用示例
compile 'com.android.support:recyclerview-v7:23.3.0'

1.去JCenter官網註冊個帳號,這裏有一個問題,就是國內的郵箱好像不行,xxxxxxx@163.com xxxxxx@qq.com都不能夠。 這裏推薦一個:outlook郵箱。…… 由於我就是用這個的 (´・_・`) 當時找了很久才找到 JCenter註冊地址 https://bintray.com/signup/ossandroid


2.新建一個項目:[Add New Repository] → Name:填寫 maven → Type:選擇 Maven → 點擊:Createios

輸入圖片說明

3.鼠標移到右上角,你的帳號上,會自動下拉出一個列表:點擊 Edit Profile ** → 點擊 : [API Key] → 輸入你的密碼,就能獲得你的[API Key]**,複製保存下來之後會用到web


###編輯你的項目 Module的build.gradleapi

apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: 'com.novoda.bintray-release'

android {
    ...
    ....
    productFlavors {
    }
    lintOptions {
        abortOnError false
        checkReleaseBuilds false
    }
}

publish {
    userOrg = '這裏填你的jcenter帳戶'// 用戶所在組織,好像是用
    groupId = 'com.xiaolei'// 包名
    artifactId = 'ios_ui'// library的名字
    publishVersion = '1.0.0'// 版本
    desc = 'library描述'
    website = "你的開源地址,注意,必定要用GitHub地址"
}

Project的 build.gradleoracle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
        classpath 'com.novoda:bintray-release:0.9'
    }
}
allprojects {
    repositories {
        jcenter()
    }
    tasks.withType(Javadoc) {
        options {
            encoding "UTF-8"
            charSet 'UTF-8'
            links "http://docs.oracle.com/javase/7/docs/api"
            failOnError false
        }
    }
}

如今,打開你**[AndroidStudio][Terminal]**app


###輸入以下:maven

gradlew clean build bintrayUpload -PbintrayUser=這裏填你的JCenter帳號 -PbintrayKey=這裏填你的APIKey -PdryRun=false

若是提示gradlew 不存在,輸入 gradlew -v 等跑完了,再輸入上面的命令gradle

相關文章
相關標籤/搜索