apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { signingConfigs { release { storeFile file('D:\\Android\\auto_click\\autoclick.jks') storePassword 'kuxuan' keyAlias = 'autoclick' keyPassword 'kuxuan' } } compileSdkVersion 30 defaultConfig { applicationId "com.kuxuan.autoclick" minSdkVersion 21 targetSdkVersion 30 versionCode 266 versionName "v2.0.66" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } applicationVariants.all { //判断是release还是debug版本 def buildType = it.buildType.name def fileName def outputFile //下面的channel是获取渠道号,你获取渠道号不一定会和我的代码一样,因为有可能你的渠道名称的规则和我的不一样,我的规则是${渠道名}-${applicationId},所以我是这样取的。 // def channel = it.productFlavors[0].name.split("-")[0] //获取当前时间的"YYYY-MM-dd"格式。 def createTime = new Date().format("YYYY-MM-dd", TimeZone.getTimeZone("GMT+08:00")) it.outputs.each { outputFile = it.outputFile //我此处的命名规则是:渠道名_项目名_版本名_创建时间_构建类型.apk fileName = "群发工具-${createTime}-${defaultConfig.versionName}.apk" // fileName = "${channel}_项目名称_v${defaultConfig.versionName}_${createTime}-${buildType}.apk" //将名字打印出来,以便及时查看是否满意。 println "文件名:-----------------${fileName}" //重新对apk命名。(适用于Gradle4.0以下版本) // it.outputFile = new File(outputFile.parent, fileName) //重新对apk命名。(适用于Gradle4.0(含)以上版本)如果你Gradle版本是4.x则将上面的一行代码注释,解开注释下面的这一行。 it.outputFileName = fileName } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test:runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' implementation "androidx.core:core-ktx:1.0.1" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.1" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.1" //工具集 api 'com.blankj:utilcodex:1.31.0' implementation 'androidx.recyclerview:recyclerview:1.2.0' implementation 'com.google.code.gson:gson:2.8.9' //butterknife implementation 'com.jakewharton:butterknife:10.2.1' annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1' //eventBus implementation 'org.greenrobot:eventbus:3.2.0' implementation 'androidx.annotation:annotation:1.1.0' // RxJava依赖 implementation 'io.reactivex.rxjava2:rxjava:2.1.3' implementation 'io.reactivex.rxjava2:rxandroid:2.0.1' //日志拦截器依赖 implementation 'com.squareup.okhttp3:okhttp:4.9.0' implementation 'com.squareup.okhttp3:logging-interceptor:3.5.0' // retrofit依赖 implementation 'com.squareup.retrofit2:retrofit:2.5.0' // RxJava和Retrofit混用的适配器 implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0' //gson转换器依赖 implementation 'com.squareup.retrofit2:converter-gson:2.5.0' //gson依赖 implementation 'com.google.code.gson:gson:2.8.5' // 直播业务需要cardview //noinspection GradleCompatible implementation 'com.android.support:cardview-v7:28.0.0' // //多文件上传 下载 带进度 框架 // implementation 'com.github.zhouxu88:OkHttp3_MultiFile:v1.0' implementation project(':library') }