0 Star 2 Fork 0

灰灰手记/XLog

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
build.gradle 2.00 KB
一键复制 编辑 原始数据 按行查看 历史
XShawn 提交于 2024-07-18 23:39 +08:00 . [2.4.11]更新依赖库版本
apply plugin: 'com.android.library'
static String buildTime() {
return new Date().format("\"yyyy.MM.dd HH:mm\"", TimeZone.getTimeZone("GMT+8"))//China
}
/// 打包时自动改文件名的代码无法直接读取版本号
final def VERSION_CODE = 11
final def VERSION_NAME = "2.4-" + VERSION_CODE
android {
namespace 'x.shawn.log'
compileSdkVersion 33
buildToolsVersion "33.0.3"
defaultConfig {
minSdkVersion 11
targetSdkVersion 33
versionCode VERSION_CODE
versionName VERSION_NAME
consumerProguardFiles "consumer-rules.pro"
// 新增BuildConfig属性
buildConfigField("int", "VERSION_CODE", "${versionCode}")
buildConfigField("String", "VERSION_NAME", "\"${versionName}\"")
buildConfigField("String", "RELEASE_TIME", buildTime())
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs/jni'] //引入libs中的so,包含aar中的
}
}
buildFeatures {
buildConfig true
}
}
dependencies {
//implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.annotation:annotation:1.8.0'
}
// 打包定义,文件名按指定格式输出
android.libraryVariants.configureEach { variant ->
//System.err.println(variant)
variant.outputs.configureEach {
//System.err.println(outputs)
def moduleName = this.name // 取ModuleName
//outputFileName = variant.name == "debug" ? "app-debug.apk" : "${moduleName}-${variant.name}-${variant.versionName}.apk"
def filename = "${moduleName}-${VERSION_NAME}"
//System.err.println("variant.name: "+variant.name)
if (variant.name == "debug") {
filename += "-debug"
}
filename += ".aar"
outputFileName = filename
System.err.println(outputFileName)
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Android
1
https://gitee.com/XShawnNotes/XLog.git
git@gitee.com:XShawnNotes/XLog.git
XShawnNotes
XLog
XLog
xlog2

搜索帮助