From 1be60d7662081d24a3d03496630f1f0904da3a94 Mon Sep 17 00:00:00 2001 From: xwei Date: Sun, 21 Apr 2024 16:21:32 +0200 Subject: [PATCH] allow build apk when key.properties file is missing --- android/app/build.gradle | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 5e6cb7c..447ab40 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -56,21 +56,25 @@ android { } signingConfigs { - release { - def keystoreProperties = new Properties() - def keystorePropertiesFile = rootProject.file('key.properties') - if (keystorePropertiesFile.exists()) { - keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) - keyAlias keystoreProperties['keyAlias'] - keyPassword keystoreProperties['keyPassword'] - storeFile file(keystoreProperties['storeFile']) - storePassword keystoreProperties['storePassword'] - } - } + release { + def keystoreProperties = new Properties() + def keystorePropertiesFile = rootProject.file('key.properties') + if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile file(keystoreProperties['storeFile']) + storePassword keystoreProperties['storePassword'] + } + } } buildTypes { release { - signingConfig signingConfigs.release + if (signingConfigs.release.storeFile) { + signingConfig signingConfigs.release + } else { + signingConfig signingConfigs.debug + } } } }