Please read first:http://blog.saymagic.cn/2015/02/16/release-library-to-jcenter.html
The outermost build.gradle.
//top-level build file where can add configuration options common to all sub-projects/modules.Buildscript {repositories {jcenter () Maven {URL' Http://dl.bintray.com/tianzhijiexian/maven '}} dependencies {Classpath' com.android.tools.build:gradle:1.1.3 'Classpath' com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0 'Classpath' com.github.dcendents:android-maven-plugin:1.2 '//Note:do not place your application dependencies here; they belong//In the individual module build.gradle files}}allprojects {repositories {jcenter ()}}
App's Build.gradle
Apply plugin: ' Com.android.library 'Apply plugin:' Com.github.dcendents.android-maven 'Apply plugin:' Com.jfrog.bintray '//This version is differentiated from the library, so when we need to update the library, remember to modify it.Version ="1.0.0"Android {compilesdkversion Abuildtoolsversion"22.0.1"Resourceprefix"Just fill it out."Defaultconfig {minsdkversion8targetsdkversion AVersioncode1Versionname"1.0"} buildtypes {release {minifyenabledfalseproguardfiles Getdefaultproguardfile (' Proguard-android.txt '), ' Proguard-rules.pro '}} lintoptions {Abortonerrortrue}}dependencies {Compile filetree (dir:' Libs ', include: [' *.jar '])}def SiteURL=https://github.com/xxx/xxx‘//home page of the projectdef giturl = 'Https://github.com/xxx/xxx.giT//the URL of the Git repositoryGroup = "com.kale.xx"//Maven Group ID for the artifact, generally fill in your unique package nameInstall {repositories.maveninstaller {//This generates pom.xml with proper parametersPom {Project {packaging' AAR '//Add your description hereName 'Extra xxx‘//Project DescriptionURL SiteURL//Set your licenseLicenses {license {name' The Apache software License, Version 2.0 'URL' Http://www.apache.org/licenses/LICENSE-2.0.txt '}} developers {developer { ID‘Kale‘//fill in the developer's basic informationName 'Kale‘Email‘[email protected]‘}} SCM {connection Giturl de Veloperconnection giturl URL SiteURL}}}}}tasks.withtype (javacom Pile) {options.encoding= "UTF-8"}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}Javadoc {options {encoding"UTF-8"CharSet' UTF-8 'authortrue //support for author tagsVersiontrue //support for version tagsLinks "Http://docs.oracle.com/javase/7/docs/api"}}artifacts {Archives JavadocjarArchives Sourcesjar} Properties Properties=NewProperties () properties.load (Project.rootProject.file (' Local.properties '). Newdatainputstream ()) Bintray {User= Properties.getproperty ("Bintray.user") Key= Properties.getproperty ("Bintray.apikey") Configurations= [' Archives '] Pkg {repo= "Maven"//in the warehouse published to Bintray, the default account has four libraries, which we upload to Maven libraryName = "extraxxxxx"//name of the project published on BintrayWebsiteurl =SiteURL Vcsurl=Giturl Licenses= ["Apache-2.0"] Publish=true }}
Local.properties
This file--YOUR changes'll be erased! *not* be checked into Version Control systems,# as it contains information specific to your local Configurati on.## location of the SDK. This was only used by gradle.# for customization if using a Version Control System, please read the# header note.sdk.dir< /c3>=h\:\\android\\sdk= name key
Reference from:
Http://www.cnblogs.com/qianxudetianxia/p/4322331.html
Http://www.linuxidc.com/Linux/2015-02/113874.htm
Http://www.jcodecraeer.com/a/anzhuokaifa/Android_Studio/2015/0227/2502.html
Http://blog.saymagic.cn/2015/02/16/release-library-to-jcenter.html
Upload Android code to Jcenter