plugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' } android { namespace 'com.logitech.vc.kirbytest' compileSdk 34 defaultConfig { applicationId "com.logitech.vc.kirbytest" minSdk 27 targetSdk 33 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" def propsFile = rootProject.file('env.properties') def props = new Properties() props.load(new FileInputStream(propsFile)) buildConfigField "String", "API_BASE_URL", "\"${props['apiBaseUrl']}\"" buildConfigField "String", "API_KEY", "\"${props['apiKey']}\"" buildConfigField "String", "SERVICE_UUID", "\"6e400001-b5a3-f393-e0a9-e50e24dcca9e\"" buildConfigField "String", "CHAR_UUID", "\"6e400003-b5a3-f393-e0a9-e50e24dcca9e\"" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } applicationVariants.all{ variant -> variant.outputs.each{ output-> // on below line we are specifying our app name. project.ext { appName = 'kirbyTestApp' } // on below line we are adding the formatted date to our apk file name. def formattedDate = new Date().format('yyyyMMdd') // on below line we are creating a new name for our apk. def newName = output.outputFile.name // on below line we are replacing our previous name with our app name. newName = newName.replace("app-", "$project.ext.appName-") // 當build type為 debug時觸發 // on below line we are replacing -debug with our formatted date. newName = newName.replace("-debug", "-debug-" + formattedDate) // 當build type為 release時觸發 // on below line we are replacing -release with our formatted date. newName = newName.replace("-release", "-release-" + formattedDate) // at last we are setting our apk name to it. output.outputFileName = newName } } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' } buildFeatures { viewBinding true buildConfig true } } dependencies { implementation 'androidx.core:core-ktx:1.8.0' implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'com.google.android.material:material:1.5.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.3' implementation 'androidx.navigation:navigation-fragment-ktx:2.5.2' implementation 'androidx.navigation:navigation-ui-ktx:2.5.2' implementation 'androidx.activity:activity:1.8.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' implementation 'androidx.recyclerview:recyclerview:1.2.0' implementation 'com.google.code.gson:gson:2.8.8' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0' implementation group: 'commons-codec', name: 'commons-codec', version: '1.16.0' implementation "com.android.volley:volley:1.2.1" implementation "androidx.datastore:datastore-preferences:1.0.0" }