How to change app version in ionic framework?

For ionic 4, there is no android-versionCode field. So you should change the version in widget field (usually line 2) in the config.xml file.

For example:

<widget id="myapp.mycompany.com" version="0.0.3" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

In this case, just change the version from 0.0.3 to 0.0.4 or to whatever number you want.


change these lines in config.xml. Build one at each time. Hope this will help

<!-- Android -->
<widget id="io.cordova.hellocordova" version="0.0.1" android-versionCode="13" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
</widget>

<!-- iOS -->
<widget id="io.cordova.hellocordova" version="0.0.1" ios-CFBundleVersion="0.1.3" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
</widget>

For the android, you have to edit your build.gradle file which will be available inside android folder inside your project.

In build.gradle file, you have to change versionCode and versionName

see the example code below

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.companyname.appname"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

In config.xml

<widget android-packageName="com.package.app.android" android-versionCode="1000" id="com.package.app" version="1.0" xmlns="w3.org/ns/widgets"; xmlns:cdv="cordova.apache.org/ns/1.0">