Dancer
Dancer

Reputation: 17651

Phonegap - Android App - alter version number?

just a quick one - can anyone advise how I can alter the version number of my compiled apk?

Thanks Paul

Upvotes: 1

Views: 1302

Answers (3)

profimedica
profimedica

Reputation: 2830

Add this attribute to widget tag in config.xml

android-versionCode="30"

Example:

<widget id="com.profimedica.ajuro" 
    android-versionCode="29"
    version="0.0.3" 
    xmlns="http://www.w3.org/ns/widgets" 
    xmlns:cdv="http://cordova.apache.org/ns/1.0">

Because Phonegap ignore the AndroidManifest.xml I assume build.gradle rules is appending number 8 to my version number resulting in 298 due to this code:

  if (minSdkVersion >= 20) {
    defaultConfig.versionCode += 9
  } else if (minSdkVersion >= 14) {
    defaultConfig.versionCode += 8
  }

Upvotes: 0

Torsten Barthel
Torsten Barthel

Reputation: 3448

It's just simple: Just open config.xml file inside your your-project-name/www/ folder and in the all surrounding note, which e.g. looks like that:
< widget id="com.haibarbe.eurofleurs" version="1.1.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
edit the version attribute.
You just need to compile your app again and sign it freshly with your formerly created keys. Thats it.
But remember thats only valid for Android apps, iOS apps do not use that version property but use your Xcode build version number. Nevertheless that version number is exported to your Xcode project file.

Upvotes: 0

Simon MacDonald
Simon MacDonald

Reputation: 23273

Before you compile your application you modify your AndroidManifest.xml file. You'll want to modify the android:versionCode and android:versionName attributes in the manifest tag.

More info can be found here:

http://developer.android.com/guide/publishing/versioning.html

Not sure what you can do once the apk is compiled.

Upvotes: 2

Related Questions