Skip to content

Android build fails with 'Cannot convert null to File' when keystore properties are missing #30

@Bahati308

Description

@Bahati308

Component

  • formulus (React Native mobile app)

  • formulus-formplayer (React web app)

  • synkronus (Go backend server)

  • synkronus-cli (Command-line utility)

  • Documentation

  • Other (please specify)

User Story

As a developer, I want to build and run the Android app so that I can test and develop the formulus mobile application.

Description

The Android build fails with a "Cannot convert 'null' to File" error when local.properties exists but doesn't contain the required keystore properties. The build.gradle file attempts to use null values for release signing configuration without proper null checking.

Details

  • When does this bug occur? Always, when running npx react-native run-android and local.properties exists but doesn't contain FORMULUS_RELEASE_STORE_FILE property
  • What triggers the bug? The build process evaluates the release signing configuration even when the keystore properties are not set
  • Location: formulus/android/app/build.gradle line 114

Steps to Reproduce

  1. Ensure formulus/android/local.properties exists (it's auto-generated by Android Studio)
  2. Verify that local.properties does NOT contain FORMULUS_RELEASE_STORE_FILE property
  3. Run npx react-native run-android from the formulus directory
  4. Observe the build failure

Expected Behavior

The build should succeed for debug builds even when release keystore properties are not configured. The release signing configuration should only be set up when the keystore properties are actually present in local.properties.

Actual Behavior

Build fails with the following error:

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/macbookpro/OpenSource/ode/formulus/android/app/build.gradle' line: 114

* What went wrong:
A problem occurred evaluating project ':app'.
> Cannot convert 'null' to File.

Acceptance Criteria

  • The build succeeds for debug builds when keystore properties are not set
  • The release signing configuration is only applied when keystore properties exist
  • The bug can be reproduced using the steps above
  • The fix properly handles null values before passing them to rootProject.file()

Environment

OS: macOS 25.1.0 (darwin)

Node.js version:

Go version:

Docker version:

Component version/branch: formplayer-UI

Additional Context

The issue occurs because the code checks if keystorePropertiesFile.exists() but doesn't verify that the actual properties are set before using them. When keystoreProperties['FORMULUS_RELEASE_STORE_FILE'] is null, passing it to rootProject.file() causes the build to fail.

Fix Applied:
Changed line 112 in build.gradle from:

if (keystorePropertiesFile.exists()) {

to:

if (keystorePropertiesFile.exists() && keystoreProperties['FORMULUS_RELEASE_STORE_FILE']) {

This ensures that the release signing configuration is only set up when both the file exists AND the required property is present.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingformulusFor issues related to the Formulus React Native applicationpriority:mediumMedium priority issues

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions