代码拉取完成,页面将自动刷新
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)
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。