| | |
| | | zipAlignEnabled true |
| | | signingConfig signingConfigs.release |
| | | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' |
| | | applicationVariants.all { variant -> |
| | | // 更新至Android Studio 3.3 gradle 4.10.1 |
| | | variant.outputs.all { |
| | | outputFileName = "GoPost_user-${defaultConfig.versionName}-${new Date().format("yyyy-MM-dd" , TimeZone.getTimeZone("GMT+08")) }.apk" |
| | | } |
| | | } |
| | | } |
| | | debug { |
| | | minifyEnabled false |
| | |
| | | } |
| | | |
| | | } |
| | | // 在文件末尾添加 |
| | | afterEvaluate { |
| | | android.applicationVariants.all { variant -> |
| | | def variantName = variant.name |
| | | // 找到对应变体的bundle任务 |
| | | def bundleTask = tasks.findByName("bundle${variantName.capitalize()}") |
| | | if (bundleTask != null) { |
| | | bundleTask.doLast { |
| | | // 输出目录 |
| | | def outputDir = file("${rootDir}/app/${variantName}/") |
| | | if (outputDir.exists()) { |
| | | outputDir.listFiles().each { file -> |
| | | if (file.name.endsWith('.aab') || file.name.endsWith('.apk')) { |
| | | // 获取当前时间戳 |
| | | def timestamp = new Date().format("yyyy-MM-dd", TimeZone.getTimeZone("GMT+08")) |
| | | |
| | | // 构建新的文件名 |
| | | def newName = file.name.replace("app-${variantName}", "GoPost_user-${variant.versionName}-${timestamp}") |
| | | |
| | | // 重命名文件 |
| | | def newFile = new File(file.parentFile, newName) |
| | | |
| | | if (file.renameTo(newFile)) { |
| | | println "✅ 文件重命名成功: ${file.name} -> ${newFile.name}" |
| | | println "📁 文件路径: ${newFile.absolutePath}" |
| | | } else { |
| | | println "❌ 文件重命名失败: ${file.name}" |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | println "⚠️ 目录不存在: ${outputDir.absolutePath}" |
| | | } |
| | | } |
| | | } else { |
| | | println "⚠️ 未找到任务: ${bundleTaskName}" |
| | | } |
| | | } |
| | | } |
| | | repositories { |
| | | flatDir { |
| | | dirs 'libs' |
| | | } |
| | | } |
| | | dependencies { |
| | | implementation fileTree(dir: 'libs', include: ['*.jar','*.aar']) |
| | | implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) |
| | | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" |
| | | api "androidx.appcompat:appcompat:$support_version" |
| | | implementation 'androidx.core:core-ktx:1.3.0' |
| | |
| | | implementation("androidx.activity:activity-ktx:1.7.2") |
| | | implementation 'com.google.android.gms:play-services-recaptcha:17.1.0' |
| | | testImplementation 'junit:junit:4.12' |
| | | // androidTestImplementation 'androidx.test.ext:junit:1.1.1' |
| | | // androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' |
| | | // androidTestImplementation 'androidx.test.ext:junit:1.1.1' |
| | | // androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' |
| | | implementation project(path: ':xldutils-kotlin') |
| | | implementation 'com.google.android.material:material:1.3.0-alpha01' |
| | | implementation project(path: ':rxnetty') |