Android Studio从jCenter发布和下载Library

使用这篇文章中所讲解的内容,可以上传文件到jCenter,亲测可行。

1. Terminal使用的命令行有两个:gradlew install和gradlew bintrayUpload, 注意是“gradlew”而不是“gradle”,如果使用“gradle”会报【'gradle' 不是内部或外部命令,也不是可运行的程序   】的错误。

2. 修改gradle文件:
在project下的build.gradle文件中添加

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
在Library下的build.gradle文件中添加:
ext {
    bintrayRepo = 'maven'
    bintrayName = 'dateutils'

    publishedGroupId = 'com.atide.utils.dateutils'
    libraryName = 'DateUtils'
    artifact = 'dateutils'

    libraryDescription = 'Android commonly date utils.'

    siteUrl = 'null'
    gitUrl = 'null'

    libraryVersion = '0.1.9'

    //作者信息
    developerId = 'grofis'
    developerName = 'Grofis Wagner'
    developerEmail = '[email protected]'

    licenseName = 'The Apache Software License, Version 2.0'
    licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
    allLicenses = ["Apache-2.0"]
}

apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'





你可能感兴趣的:(android,gradle,Studio,Jcenter)