From 76d68e9f0c8455563957b712faff8b2408bd73ae Mon Sep 17 00:00:00 2001 From: nian1 Date: Tue, 18 Jun 2024 19:19:12 +0800 Subject: [PATCH] Update build.gradle.kts --- androidApp/build.gradle.kts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index 0c3b827..54c5e5a 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -34,23 +34,23 @@ android { } } - val propertyFile = project.rootProject.file("keystore.properties") + val propertyFile by lazy { project.rootProject.file("keystore.properties") } val currentSigning = if (propertyFile.exists() && propertyFile.canRead()) { - val properties = Properties().apply { - propertyFile.inputStream().use { load(it) } - } - if (file(properties["storeFile"] as String).canRead()) { + val properties = Properties().apply { propertyFile.inputStream().use { load(it) } } + val currentStoreFile by lazy { file(properties.getProperty("storeFile")) } + if (currentStoreFile.exists() && currentStoreFile.canRead()) { signingConfigs.create("release") { - storeFile = file(properties["storeFile"] as String) - storePassword = properties["storePassword"] as String - keyAlias = properties["keyAlias"] as String - keyPassword = properties["keyPassword"] as String + storeFile = currentStoreFile + storePassword = properties.getProperty("storePassword") + keyAlias = properties.getProperty("keyAlias") + keyPassword = properties.getProperty("keyPassword") } } else { - println("Oops,storeFile can't read!") + println("Oops, storeFile can't be read!") signingConfigs.getByName("debug") } } else { + println("Oops, keystore.properties can't be read!") signingConfigs.getByName("debug") }