参考文章
Android上传开源项目(Library)到Jcenter
说明
Jcenter上传步骤还是比较简单,很多博客已经说明了很多,我只想说明一些步骤和一些我遇到的问题,解决这些问题,我不知道是否为巧合导致
我遇到的问题
一张图足以展示问题

引入bintray-release
项目根目录的build.gradle
dependencies {
classpath "com.android.tools.build:gradle:3.3.1"
classpath 'com.novoda:bintray-release:0.9.2' //引入
}
lib包build.gradle修改
plugins {
id 'com.android.library'
}
apply plugin: 'com.novoda.bintray-release' //添加
android {
defaultConfig {
...
}
buildTypes {
release {
minifyEnabled false // 必须false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false // 必须false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
publish {
repoName="wjkj" //仓库名
userOrg = 'gaoxiaoxiong' //bintray注册的用户名
groupId = 'com.wjxls' //compile引用时的第1部分groupId
artifactId = 'httputil_android' //compile引用时的第2部分项目名 这里需要对应 wjkj 下面的新的Package Name
publishVersion = '1.0.1' //compile引用时的第3部分版本号
desc = ''//d项目描述
website = 'https://github.com/caocao123/httpSdkUtil' //github 托管地址
}
注意 这里minifyEnabled 都必须为false,我之前不知道上传了多少次,都是不成功,然后我突然想到我把 release 的minifyEnabled 改为false尝试一下,结果就通过了
剩下add to jcenter 那些我就不展示了,我们提交代码到jcenter,要给其它人用,需要官方人员审核我们的代码的。
网友评论