# versionCode not updating on android APK

**URL:** <https://forum.ionicframework.com/t/versioncode-not-updating-on-android-apk/7305>\
**Category:** ionic-v1\
**Created:** [July 24, 2014, 5:03pm UTC](https://forum.ionicframework.com/t/versioncode-not-updating-on-android-apk/7305 "2014-07-24T17:03:12Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![th3brink](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/th3brink/32/96001_2.png) [@th3brink](https://forum.ionicframework.com/u/th3brink)\
**Post date:** [July 24, 2014, 5:03pm UTC](https://forum.ionicframework.com/t/versioncode-not-updating-on-android-apk/7305/1 "2014-07-24T17:03:13Z")

</div>

I released my app, and now I need to upload some bug fixes. I use ionic package release android to get my APK, but the APK’s version code doesn’t change even though I changed it in the AndroidManifest.xml

```
android:versionCode="2"

```

Any way to properly change this?

---

<div class="post-metadata">

**Author:** ![matheusrocha89](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/matheusrocha89/32/7980_2.png) [@matheusrocha89](https://forum.ionicframework.com/u/matheusrocha89)\
**Post date:** [July 24, 2014, 6:17pm UTC](https://forum.ionicframework.com/t/versioncode-not-updating-on-android-apk/7305/2 "2014-07-24T18:17:40Z")

</div>

This version code you change on `config.xml` file.

---

<div class="post-metadata">

**Author:** ![andrewmcgivery](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/andrewmcgivery/32/65523_2.png) [@andrewmcgivery](https://forum.ionicframework.com/u/andrewmcgivery)\
**Post date:** [July 24, 2014, 6:36pm UTC](https://forum.ionicframework.com/t/versioncode-not-updating-on-android-apk/7305/3 "2014-07-24T18:36:05Z")

</div>

This is configured on the “widget” element of your config.xml.

Example:

```
<?xml version="1.0" encoding="UTF-8" ?>
    <widget xmlns = "http://www.w3.org/ns/widgets"
        xmlns:gap = "http://phonegap.com/ns/1.0"
        id = "APP ID" 
        version = "2.1.0"
		versionCode = "307" 		
		>
```

---

<div class="post-metadata">

**Author:** ![th3brink](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/th3brink/32/96001_2.png) [@th3brink](https://forum.ionicframework.com/u/th3brink)\
**Post date:** [July 29, 2014, 2:14am UTC](https://forum.ionicframework.com/t/versioncode-not-updating-on-android-apk/7305/4 "2014-07-29T02:14:07Z")

</div>

I was using “ionic package release android” to prepare my apk, but it wouldn’t update the versionCode. I tried putting the versionCode in config.xml, but that didn’t work, so I just buld the apk myself now.

---

<div class="post-metadata">

**Author:** ![danihuge](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@danihuge](https://forum.ionicframework.com/u/danihuge)\
**Post date:** [September 24, 2014, 10:59am UTC](https://forum.ionicframework.com/t/versioncode-not-updating-on-android-apk/7305/5 "2014-09-24T10:59:25Z")

</div>

In Cordova 3.5.x the param in config.xml is: android-versionCode.

Sample:

widget id=“APP ID” version=“0.0.0.1” android-versionCode=“3”

---

<div class="post-metadata">

**Author:** ![thequiet](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/thequiet/32/83747_2.png) [@thequiet](https://forum.ionicframework.com/u/thequiet)\
**Post date:** [September 29, 2015, 7:47pm UTC](https://forum.ionicframework.com/t/versioncode-not-updating-on-android-apk/7305/6 "2015-09-29T19:47:07Z")

</div>

Did you ever figure anything out?

---

<div class="post-metadata">

**Author:** ![krishnaraj221193](https://avatars.discourse-cdn.com/v4/letter/k/85e7bf/32.png) [@krishnaraj221193](https://forum.ionicframework.com/u/krishnaraj221193)\
**Post date:** [December 2, 2015, 10:47am UTC](https://forum.ionicframework.com/t/versioncode-not-updating-on-android-apk/7305/7 "2015-12-02T10:47:50Z")

</div>

Version code is one that will be present at config.xml. once we create a platfrom using ::  
ionic platform add android  
then at platform folder–\>android–\> you will find android manifest.xml file  
open in notepad there android:versionCode=“601” android:versionName="0.6.1"  
here 601 is version code which should be changed before generating apk

android:versionName=“0.6.1” is the name that is displayed at user side at setting option  
version 0.6.1  
this versionname is optional

---

<div class="post-metadata">

**Author:** ![abhi2411](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@abhi2411](https://forum.ionicframework.com/u/abhi2411)\
**Post date:** [September 2, 2016, 1:32pm UTC](https://forum.ionicframework.com/t/versioncode-not-updating-on-android-apk/7305/8 "2016-09-02T13:32:28Z")

</div>

\*\*how to set version code in ionic in manifest file i already change the version code but when i build its change again to one . kindly  
tell how to process this because i am new in this . kindly tell thanks  
in advance .want to update app on play store but when try this every time i am getting this error :-  
You need to use a different version code for your APK because you already have one with version code 1.

```
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="2" android:versionName="1.1" package="com.ionicframework.chalisa863645" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:name="com.google.android.gms.ads.AdActivity" android:theme="@android:style/Theme.Translucent" />
    </application>
    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
```

---

<div class="post-metadata">

**Author:** ![A\_Burgess](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/a_burgess/32/102501_2.png) [@A\_Burgess](https://forum.ionicframework.com/u/A_Burgess)\
**Post date:** [September 2, 2016, 2:44pm UTC](https://forum.ionicframework.com/t/versioncode-not-updating-on-android-apk/7305/9 "2016-09-02T14:44:46Z")

</div>

That file is generated, change config.xml in your project root instead.

---

<div class="post-metadata">

**Author:** ![raja1988m](https://avatars.discourse-cdn.com/v4/letter/r/e47774/32.png) [@raja1988m](https://forum.ionicframework.com/u/raja1988m)\
**Post date:** [March 15, 2017, 6:41am UTC](https://forum.ionicframework.com/t/versioncode-not-updating-on-android-apk/7305/10 "2017-03-15T06:41:37Z")

</div>

if you really dont want to generate Version code(60002) automatically based on Version(6.0.2) then you can pass your user defined customized version code from config.xml itself like this -  
**\<widget id=“[xxx.xxxx.xxx](http://xxx.xxxx.xxx)” _android-versionCode=“60005”_ version=“6.0.2” xmlns=“[http://www.w3.org/ns/widgets](http://www.w3.org/ns/widgets)” xmlns:cdv=“[http://cordova.apache.org/ns/1.0](http://cordova.apache.org/ns/1.0)”\>**

Then it will get updated automatically in android manifest file also.

---

<div class="post-metadata">

**Author:** ![soookayyy](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@soookayyy](https://forum.ionicframework.com/u/soookayyy)\
**Post date:** [February 15, 2018, 3:30pm UTC](https://forum.ionicframework.com/t/versioncode-not-updating-on-android-apk/7305/11 "2018-02-15T15:30:38Z")

</div>

this is the best answer. setting up your config file properly will make sure your numbers carry to every location they need to be carried over too

---

<div class="post-metadata">

**Author:** ![sibabratswain](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sibabratswain/32/121549_2.png) [@sibabratswain](https://forum.ionicframework.com/u/sibabratswain)\
**Post date:** [September 8, 2018, 8:02am UTC](https://forum.ionicframework.com/t/versioncode-not-updating-on-android-apk/7305/12 "2018-09-08T08:02:04Z")

</div>

bro there is command while you built the ionic project mention the version code and you do not have to mention it any where .

```auto
ionic cordova build android --release -- -- --versionCode=3

```

for the reference [Please Visit This](https://pointdeveloper.com/change-versioncode-cordova-ionic-apps-android/)

---

<div class="post-metadata">

**Author:** ![Wcjord](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/wcjord/32/122714_2.png) [@Wcjord](https://forum.ionicframework.com/u/Wcjord)\
**Post date:** [January 11, 2019, 8:54am UTC](https://forum.ionicframework.com/t/versioncode-not-updating-on-android-apk/7305/13 "2019-01-11T08:54:32Z")

</div>

None of these are working for me.

My config.xml has

```auto
<widget android-versionCode="2" id="xx.xx.xx" ios-CFBundleVersion="2" version="0.0.4" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

```

My full build script is:

```auto
env ENV=prod ionic cordova build android --prod --release -- -- --versionCode=2 --gradleArg=-PcdvVersionCode=2

```

Environment info:

```auto
Ionic:

   ionic (Ionic CLI) : 4.2.1
   Ionic Framework : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.0

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms : android 7.1.4, browser 5.0.3, ios 4.5.5
   Cordova Plugins : no whitelisted plugins (19 plugins total)

System:

   Android SDK Tools : 26.1.1 (/Users/<username>/Library/Android/android-sdk)
   ios-deploy : 2.0.0
   NodeJS : v8.11.3 (/usr/local/bin/node)
   npm : 5.6.0
   OS : macOS
   Xcode : Xcode 10.1 Build version 10B61

```

But the output of “aapt dump badging appname.apk” is still  
`versionCode='1' versionName='0.0.3' platformBuildVersionName='0.0.3'`

Any updates to this problem?
