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 {
|
plugins {
|
||||||
id("com.android.application")
|
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("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 {
|
android {
|
||||||
namespace = "com.example.motorcycle_dash"
|
namespace = "app.motorsignal.motorcycle"
|
||||||
compileSdk = 37
|
compileSdk = 37
|
||||||
ndkVersion = flutter.ndkVersion
|
ndkVersion = flutter.ndkVersion
|
||||||
|
|
||||||
|
|
@ -15,25 +52,30 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
applicationId = "app.motorsignal.motorcycle"
|
||||||
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.
|
|
||||||
minSdk = flutter.minSdkVersion
|
minSdk = flutter.minSdkVersion
|
||||||
targetSdk = flutter.targetSdkVersion
|
targetSdk = flutter.targetSdkVersion
|
||||||
versionCode = flutter.versionCode
|
versionCode = flutter.versionCode
|
||||||
versionName = flutter.versionName
|
versionName = flutter.versionName
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
signingConfigs {
|
||||||
release {
|
create("release") {
|
||||||
// TODO: Add your own signing config for the release build.
|
keyAlias = releaseKeyAlias
|
||||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
keyPassword = releaseKeyPassword
|
||||||
signingConfig = signingConfigs.getByName("debug")
|
storePassword = releaseStorePassword
|
||||||
}
|
storeFile = rootProject.file(releaseStoreFile)
|
||||||
|
storeType = "PKCS12"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
signingConfig = signingConfigs.getByName("release")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
compilerOptions {
|
compilerOptions {
|
||||||
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
|
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
|
||||||
|
|
@ -42,4 +84,4 @@ kotlin {
|
||||||
|
|
||||||
flutter {
|
flutter {
|
||||||
source = "../.."
|
source = "../.."
|
||||||
}
|
}
|
||||||
|
|
@ -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