build: android signed release

This commit is contained in:
ardocrat 2024-09-14 02:06:35 +03:00
parent 68c9c9df04
commit d39e2ec21e
2 changed files with 21 additions and 13 deletions

View file

@ -2,10 +2,6 @@ plugins {
id 'com.android.application' id 'com.android.application'
} }
def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android { android {
compileSdk 33 compileSdk 33
ndkVersion '26.0.10792818' ndkVersion '26.0.10792818'
@ -18,20 +14,32 @@ android {
versionName "0.1.3" versionName "0.1.3"
} }
signingConfigs { def keystorePropertiesFile = rootProject.file("keystore.properties")
release { def keystoreProperties = new Properties()
keyAlias keystoreProperties['keyAlias'] if (keystorePropertiesFile.exists()) {
keyPassword keystoreProperties['keyPassword'] keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword'] signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
} }
} }
buildTypes { buildTypes {
release { release {
minifyEnabled false minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release }
if (keystorePropertiesFile.exists()) {
signedRelease {
initWith release
signingConfig signingConfigs.release
}
} }
debug { debug {
minifyEnabled false minifyEnabled false

View file

@ -59,12 +59,12 @@ function build_apk() {
cd android cd android
./gradlew clean ./gradlew clean
./gradlew assembleRelease ./gradlew assembleSignedRelease
# Setup release file name # Setup release file name
if [ -n $1 ]; then if [ -n $1 ]; then
rm -rf grim-${version}-$1.apk 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 fi
cd .. cd ..