[FIXED] ionic 6 capacitor cannot change the app version on android

Issue

I am using Ionic 6 and capacitor in a project.

In the config.xml file I have:

    <widget xmlns="w3.org/ns/widgets"; xmlns:cdv="cordova.apache.org/ns/1.0">

When I try to change it to:

    <widget version="0.0.1" xmlns="w3.org/ns/widgets"; xmlns:cdv="cordova.apache.org/ns/1.0">

and then do ionic build android the version disappears and nothing is changed in the AndroidManifest.xml file.

When I import the apk or other into google play to test it tells me that the version already exists.

So how do I change the app version?

Solution

Forget about config.xml, that’s a cordova thing and not used in capacitor (other that being there for the cordova plugin compatibility).

In capacitor apps you manage the version as you would do in a native android app, that’s changing the values in the android/app/build.gradle file.

There are two fields:

  • versionCode: this is the version you have to increment every time you submit a new version to google play. It’s an integer.
  • versionName: this is the visible version that will be displayed in google play. It’s a string.

Answered By – jcesarmobile

Answer Checked By – Marilyn (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published