diff --git a/android/app/build.gradle b/android/app/build.gradle index 98a54b8..71d2129 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -2,10 +2,6 @@ plugins { id 'com.android.application' } -def keystorePropertiesFile = rootProject.file("keystore.properties") -def keystoreProperties = new Properties() -keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) - android { compileSdk 33 ndkVersion '26.0.10792818' @@ -18,20 +14,32 @@ android { versionName "0.1.3" } - signingConfigs { - release { - keyAlias keystoreProperties['keyAlias'] - keyPassword keystoreProperties['keyPassword'] - storeFile file(keystoreProperties['storeFile']) - storePassword keystoreProperties['storePassword'] + def keystorePropertiesFile = rootProject.file("keystore.properties") + def keystoreProperties = new Properties() + if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) + + signingConfigs { + release { + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile file(keystoreProperties['storeFile']) + storePassword keystoreProperties['storePassword'] + } } + } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - signingConfig signingConfigs.release + } + if (keystorePropertiesFile.exists()) { + signedRelease { + initWith release + signingConfig signingConfigs.release + } } debug { minifyEnabled false diff --git a/scripts/android.sh b/scripts/android.sh index 519ce6c..d377e70 100755 --- a/scripts/android.sh +++ b/scripts/android.sh @@ -59,12 +59,12 @@ function build_apk() { cd android ./gradlew clean - ./gradlew assembleRelease + ./gradlew assembleSignedRelease # Setup release file name if [ -n $1 ]; then rm -rf grim-${version}-$1.apk - mv app/build/outputs/apk/release/app-release.apk grim-${version}-$1.apk + mv app/build/outputs/apk/signedRelease/app-signedRelease.apk grim-${version}-$1.apk fi cd ..