Skip to content

fix: Guard signingConfigs behind key.properties existence check#2102

Open
sunbird89629 wants to merge 1 commit into
imaNNeo:mainfrom
sunbird89629:fix/android-signing-config-null-cast
Open

fix: Guard signingConfigs behind key.properties existence check#2102
sunbird89629 wants to merge 1 commit into
imaNNeo:mainfrom
sunbird89629:fix/android-signing-config-null-cast

Conversation

@sunbird89629
Copy link
Copy Markdown

@sunbird89629 sunbird89629 commented May 19, 2026

Summary

  • Wrap signingConfigs and its usage in keystorePropertiesFile.exists() check
  • Prevents null cannot be cast to non-null type kotlin.String error when key.properties is missing

Problem

The example app's build.gradle.kts unconditionally accesses keystoreProperties["keyAlias"] as String in the signingConfigs block. When key.properties doesn't exist (fresh clone, local dev), this crashes with:

null cannot be cast to non-null type kotlin.String

Fix

Guard both the signingConfigs creation and its usage in buildTypes.release behind keystorePropertiesFile.exists().

Test plan

  • Verify flutter build apk works without key.properties
  • Verify flutter build apk --release works with valid key.properties

Wrap signingConfigs and its usage in `keystorePropertiesFile.exists()`
to prevent `null cannot be cast to non-null type kotlin.String` error
when key.properties is missing (e.g., fresh clone or local dev).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant