feat: Android signing config (demo keystore optional) + keystore.properties.example

This commit is contained in:
2026-09-01 18:55:58 +08:00
parent 42ad836e95
commit 7dc1a2665f
3 changed files with 47 additions and 0 deletions
+2
View File
@@ -8,3 +8,5 @@ local.properties
captures/ captures/
.externalNativeBuild/ .externalNativeBuild/
.cxx/ .cxx/
keystore.properties
keystore/
+33
View File
@@ -1,6 +1,13 @@
plugins { plugins {
id 'com.android.application' id 'com.android.application'
} }
def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android { android {
namespace 'com.dshwatch.app' namespace 'com.dshwatch.app'
compileSdk 34 compileSdk 34
@@ -11,17 +18,43 @@ android {
versionCode 1 versionCode 1
versionName "0.1.0" versionName "0.1.0"
} }
signingConfigs {
if (keystorePropertiesFile.exists()) {
debug {
storeFile file(keystoreProperties['debug.store.file'])
storePassword keystoreProperties['debug.store.password']
keyAlias keystoreProperties['debug.key.alias']
keyPassword keystoreProperties['debug.key.password']
}
release {
storeFile file(keystoreProperties['release.store.file'])
storePassword keystoreProperties['release.store.password']
keyAlias keystoreProperties['release.key.alias']
keyPassword keystoreProperties['release.key.password']
}
}
}
buildTypes { buildTypes {
release { release {
minifyEnabled false minifyEnabled false
if (keystorePropertiesFile.exists()) {
signingConfig signingConfigs.release
}
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
} }
debug {
minifyEnabled false
if (keystorePropertiesFile.exists()) {
signingConfig signingConfigs.debug
}
}
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_17 sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17
} }
} }
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.appcompat:appcompat:1.6.1'
+12
View File
@@ -0,0 +1,12 @@
# Fill these and copy to keystore.properties (NOT committed)
# debug sign
debug.store.file=../keystore/keystore.jks
debug.store.password=REPLACE_MEwearable
debug.key.alias=REPLACE_MEwearable
debug.key.password=REPLACE_MEwearable
# release sign
release.store.file=../keystore/keystore.jks
release.store.password=REPLACE_MEwearable
release.key.alias=REPLACE_MEwearable
release.key.password=REPLACE_MEwearable