Skip to content

Fix: assembleDebug fails on a fresh clone without keystore.properties#6

Open
7MS8 wants to merge 1 commit into
IliyaBrook:masterfrom
7MS8:fix/debug-build-without-keystore
Open

Fix: assembleDebug fails on a fresh clone without keystore.properties#6
7MS8 wants to merge 1 commit into
IliyaBrook:masterfrom
7MS8:fix/debug-build-without-keystore

Conversation

@7MS8

@7MS8 7MS8 commented Jul 13, 2026

Copy link
Copy Markdown

What's broken

./gradlew assembleDebug fails immediately on a fresh clone (no keystore.properties, which is gitignored — as documented in the README/CLAUDE.md):

* Where:
Build file '.../app/build.gradle.kts' line: 35
* What went wrong:
Cannot convert '' to File.

Cause: signingConfigs { create("release") { storeFile = file(keystoreProperties.getProperty("storeFile", "")) ... } } runs unconditionally. Gradle evaluates the whole android {} DSL at configuration time regardless of which task is requested, so even assembleDebug hits file("") and crashes.

Fix

Guard both the signingConfigs.create("release") block and the signingConfig = ... assignment in release {} behind keystorePropertiesFile.exists(). Release builds still pick up signing exactly as before once keystore.properties exists; debug builds (and assembleRelease without a keystore, which just produces an unsigned APK) no longer crash.

Verified

rm -f keystore.properties  # confirm it's absent
./gradlew clean assembleDebug   # BUILD SUCCESSFUL, 43 tasks executed

Ran into this while evaluating the project as a translation backend for another app — happy to adjust the approach if you'd prefer a different guard style (e.g. failing loudly with a clearer message instead of silently skipping signing).

assembleDebug currently fails on a fresh clone with "Cannot convert ''
to File" because the release signingConfig block unconditionally calls
file(keystoreProperties.getProperty("storeFile", "")) — Gradle
evaluates the whole android{} DSL at configuration time regardless of
which build type is requested, so this breaks debug builds too when no
keystore.properties is present (it's gitignored, so every fresh clone
hits this).

Wrapping both the signingConfigs.create("release") block and the
signingConfig assignment in release{} behind
keystorePropertiesFile.exists() lets assembleDebug (and assembleRelease
without a keystore) build cleanly, while release builds still pick up
signing once keystore.properties exists.

Verified: ./gradlew clean assembleDebug succeeds with no
keystore.properties in the tree at all.
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