feat(android): configurar soporte de firma de release, plantilla key.properties y resguardo en gitignore

This commit is contained in:
Pablinux
2026-10-15 23:25:03 -05:00
parent 359bac1f1a
commit 5489a14baa
5 changed files with 35 additions and 4 deletions
+2
View File
@@ -9,3 +9,5 @@ GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
*.jks
*.keystore
+22 -3
View File
@@ -6,6 +6,13 @@ if (localPropertiesFile.exists()) {
}
}
// Carga de credenciales de firma de producción desde android/key.properties (ignorado por Git)
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
@@ -47,11 +54,23 @@ android {
multiDexEnabled true
}
// Configuración de firmas: se usa la clave de producción si key.properties existe;
// de lo contrario, se mantiene la firma debug para no romper entornos locales de desarrollo.
signingConfigs {
release {
if (keystorePropertiesFile.exists()) {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
// Asigna automáticamente signingConfigs.release si el archivo key.properties está presente
signingConfig (keystorePropertiesFile.exists() ? signingConfigs.release : signingConfigs.debug)
}
}
}
+7
View File
@@ -0,0 +1,7 @@
# Plantilla de configuración de firma para Android Release (Google Play)
# Copiar este archivo como 'android/key.properties' y completar con los valores reales.
# El archivo 'key.properties' está ignorado en .gitignore para resguardar las claves.
storeFile=upload-keystore.jks
storePassword=REPLACE_LOCALLY
keyAlias=como-gasto-upload
keyPassword=REPLACE_LOCALLY