apply plugin: 'com.android.library' apply plugin: 'com.jfrog.bintray' apply plugin: 'com.github.dcendents.android-maven' def siteUrl = 'https://github.com/DmcSDK/MediaPickerPoject' // 项目的主页 def gitUrl = 'https://github.com/DmcSDK/MediaPickerPoject.git' // Git仓库的url Properties properties = new Properties() properties.load(project.rootProject.file('local.properties').newDataInputStream()) version = "3.3" //发布版本号 group = "com.dmcBig" //最终引用形式,如compile 'com.**; android { compileSdkVersion 25 buildToolsVersion '28.0.2' defaultConfig { minSdkVersion 15 targetSdkVersion 25 versionCode 1 versionName "3.3" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:25.3.1' testCompile 'junit:junit:4.12' compile 'com.android.support:recyclerview-v7:25.3.1' compile 'com.android.support:support-v4:25.3.1' // annotationProcessor 'com.github.bumptech.glide:compiler:5.0.0' // compile 'com.github.bumptech.glide:glide:4.0.0' compile 'pub.devrel:easypermissions:1.0.0' compile 'com.github.chrisbanes.photoview:library:1.2.4' } bintray { user = properties.getProperty("bintray.user") key = properties.getProperty("bintray.apikey") pkg { repo = 'dmcBig'//自己创建的仓库名字 name = 'MediaPicker'//上传到JCenter的名字,最终引用的名字 websiteUrl = siteUrl vcsUrl = gitUrl licenses = ['Apache-2.1']//不能随便写,只能是仓库创建时选择的license type userOrg = 'yuanwu' //自己创建的organization名称 publish = true // 是否是公开项目,公开别人可以引用 version { name = '3.3' desc = 'MediaPicker open library.'//描述,自己定义 released = new Date() vcsTag = 'v1.1' attributes = ['gradle-plugin': 'com.use.less:com.use.less.gradle:gradle-useless-plugin'] } } configurations = ['archives'] } install { repositories.mavenInstaller { // This generates POM.xml with proper parameters pom { project { packaging 'aar' // Add your description here name 'mediaPicker Android' description 'MediaPicker open library.' url siteUrl // Set your license licenses { license { name 'The Apache Software License, Version 2.1' url 'http://www.apache.org/licenses/LICENSE-2.1.txt' } } developers { developer { id 'dmcBig' //填写bintray或者github的用户名 name 'dmcBig' //姓名 email 'yu911512152@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) { failOnError false //必须添加以免出错 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 } javadoc { options{ //如果你的项目里面有中文注释的话,必须将格式设置为UTF-8,不然会出现乱码 encoding "UTF-8" charSet 'UTF-8' author true version true links "http://docs.oracle.com/javase/7/docs/api" } }