Files
sharedinbox/android/app/build.gradle.kts
T
Thomas SharedInboxandClaude Sonnet 4.6 e76c536e0e fix: pass keystore password as Dagger secret to Android builds
ANDROID_KEYSTORE_PASSWORD was set in the CI runner environment but never
forwarded into the Dagger container, so System.getenv() returned null
inside the Flutter build, causing a NullPointerException in
FinalizeBundleTask when signing the release bundle.

- Add keystorePassword *dagger.Secret param to BuildAndroidRelease,
  BuildAndroidApk, PublishAndroid, and DeployApk in the Dagger module
- Pass ANDROID_KEYSTORE_PASSWORD via WithSecretVariable to the build container
- Update ci.yml to supply env:ANDROID_KEYSTORE_PASSWORD to both
  publish-android and deploy-apk dagger calls
- Refactor build.gradle.kts to conditionally create the signing config
  only when both the keystore file and password are available, avoiding
  null values being passed to the signing config

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 11:18:00 +02:00

78 lines
2.3 KiB
Kotlin

plugins {
id("com.android.application")
id("kotlin-android")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")
}
android {
namespace = "de.sharedinbox.mua"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
isCoreLibraryDesugaringEnabled = true
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
val keystoreFile = file("upload-keystore.jks")
val keystorePass: String? = System.getenv("ANDROID_KEYSTORE_PASSWORD")
val hasKeystore = keystoreFile.exists() && keystorePass != null
if (hasKeystore) {
signingConfigs {
create("release") {
keyAlias = "upload"
storePassword = keystorePass
keyPassword = keystorePass
storeFile = keystoreFile
}
}
}
defaultConfig {
applicationId = "de.sharedinbox.mua"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = 23
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}
buildTypes {
release {
signingConfig = if (hasKeystore) {
signingConfigs.getByName("release")
} else {
signingConfigs.getByName("debug")
}
isMinifyEnabled = false
isShrinkResources = false
ndk {
debugSymbolLevel = "FULL"
}
}
}
}
flutter {
source = "../.."
}
dependencies {
// Required for flutter_local_notifications and other plugins that need Java 8+ APIs on API < 26.
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4")
// integration_test is a dev dependency; the Flutter plugin loader adds it as
// debugImplementation only, but GeneratedPluginRegistrant.java (in src/main)
// references its class in all variants. Make it available for release compilation
// without bundling it in the APK.
releaseCompileOnly(project(":integration_test"))
}