Skip to content

[Bug]: Android capacitor crashes on subsequent launch if versionCode/versionName omitted #7802

Open
@aeharding

Description

@aeharding

Capacitor Version

[warn] The bundledWebRuntime configuration option has been deprecated. Can be safely deleted.
💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 6.2.0
@capacitor/core: 6.2.0
@capacitor/android: 6.2.0
@capacitor/ios: 6.2.0

Installed Dependencies:

@capacitor/cli: 6.2.0
@capacitor/core: 6.2.0
@capacitor/android: 6.2.0
@capacitor/ios: 6.1.2

[success] Android looking great! 👌

Other API Details

npm --version
10.9.0

node --version
v22.11.0

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

When versionCode and versionName are omitted from build.gradle, Capacitor crashes on subsequent dev runs (after initial app install on device).

(versionCode and versionName are omitted in my project for dev builds. They are only added/controlled by CI.)

To reproduce:

  • Clone/install app
  • Run capacitor for android - npx cap open android
  • Ctrl+R to run on phone
  • Observe success
  • Ctrl+R again to update/run on phone
  • Observe crash
  • Observe crash on any further update until app is deleted from device, in which case first install will succeed again.

Expected Behavior

No crash

Project Reproduction

https://github.com/aeharding/cap-crash-test

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions