import java.text.SimpleDateFormat import java.time.LocalDateTime plugins { id 'com.android.application' id 'kotlin-android' id 'kotlin-kapt' } static int formatTime() { LocalDateTime now = LocalDateTime.now() int year = now.year % 100 // 取年份的最后两位 int month = now.monthValue int day = now.dayOfMonth int hour = now.hour int randomNumber = new Random().nextInt(10) // 生成0到9之间的随机数 return Integer.parseInt(String.format("%02d%02d%02d%02d%d", year, month, day, hour, randomNumber)) } ext{ versionCode=Integer.parseInt(new SimpleDateFormat("yyMMddHH").format(new Date()) + 1) brandCode="000A" brandVersionCode=versionCode model="3015" } android { compileSdk 31 defaultConfig { applicationId "com.develop.foodcooking" minSdk 21 targetSdk 26 versionCode project.ext.versionCode versionName "${project.ext.model}.${project.ext.brandCode}.${project.ext.versionCode}" archivesBaseName = "cofar-cooking_${versionName}" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" javaCompileOptions { annotationProcessorOptions { arguments = ["room.schemaLocation": "$projectDir/schemas".toString()] } } kapt { arguments { arg("AROUTER_MODULE_NAME", project.getName()) arg("room.schemaLocation", "$projectDir/schemas".toString()) } } packagingOptions { pickFirst 'lib/armeabi-v7a/libc++_shared.so' } } flavorDimensions "platform" productFlavors { brandDefault { dimension "platform" applicationId "com.develop.foodcooking" buildConfigField("String", "UpdatePlatform", "\"normal\"") resValue("string", "app_theme", "@style/SplashTheme") } brand034 { dimension "platform" applicationId "com.develop.foodcooking" buildConfigField("String", "UpdatePlatform", "\"night\"") resValue("string", "app_theme", "@style/Splash034Theme") } } signingConfigs { debug { storeFile file('..\\signature\\rk.jks') storePassword '123456' keyAlias 'rk' keyPassword '123456' } foodCooking { storeFile file("..\\signature\\rk.jks") storePassword '123456' keyAlias 'rk' keyPassword '123456' } release { storeFile file('..\\signature\\rk.jks') storePassword '123456' keyAlias 'rk' keyPassword '123456' } } buildTypes { release { minifyEnabled false productFlavors.brand034.signingConfig signingConfigs.release productFlavors.brandDefault.signingConfig signingConfigs.release proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' } viewBinding { enabled = true } } dependencies { implementation project(path: ':libBase') implementation project(path: ':BusinessRouter') implementation project(path: ':BusinessAuth') implementation project(path: ':BusinessSetting') implementation project(path: ':BusinessMain') implementation project(path: ':BusinessStep') kapt 'com.alibaba:arouter-compiler:1.5.1' }