FIX: Establish working production release signing
This commit is contained in:
parent
a6d632529b
commit
78d3d45570
|
|
@ -1,11 +1,48 @@
|
|||
import java.io.FileInputStream
|
||||
import java.util.Properties
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
||||
id("dev.flutter.flutter-gradle-plugin")
|
||||
id("com.google.gms.google-services")
|
||||
}
|
||||
|
||||
val keystoreProperties = Properties()
|
||||
val keystorePropertiesFile = rootProject.file("key.properties")
|
||||
|
||||
if (!keystorePropertiesFile.exists()) {
|
||||
throw GradleException(
|
||||
"Missing android/key.properties. " +
|
||||
"Create it from android/key.properties.template."
|
||||
)
|
||||
}
|
||||
|
||||
FileInputStream(keystorePropertiesFile).use {
|
||||
keystoreProperties.load(it)
|
||||
}
|
||||
|
||||
fun requiredKeystoreProperty(name: String): String {
|
||||
val value = keystoreProperties.getProperty(name)?.trim()
|
||||
|
||||
println("MotorSignal signing property [$name]: ${if (value.isNullOrEmpty()) "<MISSING>" else "<PRESENT>"}")
|
||||
|
||||
if (value.isNullOrEmpty()) {
|
||||
println("Properties actually loaded by Gradle: ${keystoreProperties.keys}")
|
||||
throw GradleException(
|
||||
"Missing $name in android/key.properties"
|
||||
)
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
val releaseStorePassword = requiredKeystoreProperty("storePassword")
|
||||
val releaseKeyPassword = requiredKeystoreProperty("keyPassword")
|
||||
val releaseKeyAlias = requiredKeystoreProperty("keyAlias")
|
||||
val releaseStoreFile = requiredKeystoreProperty("storeFile")
|
||||
|
||||
android {
|
||||
namespace = "com.example.motorcycle_dash"
|
||||
namespace = "app.motorsignal.motorcycle"
|
||||
compileSdk = 37
|
||||
ndkVersion = flutter.ndkVersion
|
||||
|
||||
|
|
@ -15,25 +52,30 @@ android {
|
|||
}
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId = "com.example.motorcycle_dash"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
||||
applicationId = "app.motorsignal.motorcycle"
|
||||
minSdk = flutter.minSdkVersion
|
||||
targetSdk = flutter.targetSdkVersion
|
||||
versionCode = flutter.versionCode
|
||||
versionName = flutter.versionName
|
||||
}
|
||||
|
||||
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.getByName("debug")
|
||||
}
|
||||
signingConfigs {
|
||||
create("release") {
|
||||
keyAlias = releaseKeyAlias
|
||||
keyPassword = releaseKeyPassword
|
||||
storePassword = releaseStorePassword
|
||||
storeFile = rootProject.file(releaseStoreFile)
|
||||
storeType = "PKCS12"
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
# MotorSignal Android Production Signing Key Configuration Template
|
||||
# Copy this file to `android/key.properties` (which is gitignored) and fill with your actual keystore details.
|
||||
|
||||
storePassword=YOUR_KEYSTORE_PASSWORD
|
||||
keyPassword=YOUR_KEY_PASSWORD
|
||||
keyAlias=motorsignal_upload_key
|
||||
storeFile=../upload-keystore.jks
|
||||
Loading…
Reference in New Issue