how does phone gap build handle app updates (android)

  • 4
  • Question
  • Updated 6 years ago
Android market states that in order to publish an update of an existing application we need to incremented the android:versionCode and android:versionName attributes in the element of the manifest file.

does phone gap build generate the manifest file? is it packed inside the APK? how does one increment the needed numbers on the specified fields.

thanks
Photo of bitwave

bitwave

  • 10 Posts
  • 0 Reply Likes
  • thankful

Posted 9 years ago

  • 4
Photo of Fil Maj

Fil Maj

  • 139 Posts
  • 15 Reply Likes
Good question!

The versionName attribute is directly taken from your config.xml. In there, you have a <widget> element at the root - this element should have a "version" attribute. This version attribute gets directly applied to Android's versionName attribute.

However, currently, the versionCode inside the Android Manifest is always statically set to "1". We will obviously have to change this to enable users to submit updates.

I will loop back with my team and report back the solution we have in place, and eventually update the documentation and code on build.phonegap.com to handle this properly.

I will keep you updated!
Photo of Fil Maj

Fil Maj

  • 139 Posts
  • 15 Reply Likes
Well, the update will be quick: I think for a first pass at the solution for this we will just use the timestamp of the last build as the versionCode - this way more recent builds are always considered "newer" versions from the Market's point of view.
Photo of bitwave

bitwave

  • 10 Posts
  • 0 Reply Likes
great thanks for the quick reply
Photo of Fil Maj

Fil Maj

  • 139 Posts
  • 15 Reply Likes
This has been deployed, by the way :)
Photo of Darren Gates

Darren Gates

  • 1 Post
  • 0 Reply Likes
hi,

Are you sure that this has actually been deployed? I'm still getting this error whenever I try to submit an upgrade to the Android market:

The new apk's versionCode (1) in AndroidManifest.xml must be higher than the old apk's versionCode (1).

I'm using http://build.phonegap.com (is there another URL that has a more recent version of the cloud compiler?)

Darren
Photo of justind000

justind000

  • 4 Posts
  • 0 Reply Likes
I'm having this problem as well. Previous config.xml had version = "1.0.0", new one says "1.1.0". When submitting the new apk it tells me this:
The new apk's versionCode (1) in AndroidManifest.xml must be higher than the old apk's versionCode (1).
Photo of justind000

justind000

  • 4 Posts
  • 0 Reply Likes
I tried it with "2.0.0" just in case it build.phonegap.com only used the first digit with no luck. After trying to submit, google told me the same thing.
Photo of Brad Lawryk - Auroratec

Brad Lawryk - Auroratec

  • 11 Posts
  • 0 Reply Likes
Same problem here .....
Photo of justind000

justind000

  • 4 Posts
  • 0 Reply Likes
Just tried this again today and same result.
Photo of labforecast

labforecast

  • 4 Posts
  • 0 Reply Likes
Hi,
I have also the same issue : in my config file I wrote
version="0.0.1"
versionCode="1"
the version is taken in account but not the version code : after an upload to the Android Market the versionCode is 4.
I tried several times and the versionCode seems to be randomly defined.

Could you help me to manage this issue. I need to be able to manage futures update of my app.

Many thanks
Photo of Rick Ramirez

Rick Ramirez

  • 30 Posts
  • 0 Reply Likes
versionCode is not the applications version update number...they are very different..

VersionCode is a android version control number only it is not the number that defines your updates...
version="0.0.1" is the only number that users that download your application see when you upload your updates and it's the only number that should be changed in your config file..

versionCode number is automatically generated by Phonegap to the next highest number when you rebuild your applications so as long as it's higher that what is in the android marketplace developers upload area it's OK that phonegap random generates it..
Photo of labforecast

labforecast

  • 4 Posts
  • 0 Reply Likes
Yes, sure, but the issue was that this VersionCode number was ramdomly generated and didn't provide a highest number (sequence generated could be 51 47 60 ...).
I got an answer from phonegap team : they have fixed the issue and it works well now (look for 'Android Marketplace Updating')
Photo of cognostek

cognostek

  • 10 Posts
  • 0 Reply Likes
This is still not working, I had version = "1.0.0", new one says "2.0.0". When submitting the new apk it tells me this: "The new apk's versionCode (37) already exists."

Please advise.
Photo of Yi Ming Kuan

Yi Ming Kuan

  • 1840 Posts
  • 78 Reply Likes
Android has two different version attributes, one for display (typically in a x.x.x format) and version code for Market versioning (an integer).

For PhoneGap Build, you would want to change the VersionCode attribute to one higher than the current version in the Market. See this page for more information.
Photo of cognostek

cognostek

  • 10 Posts
  • 0 Reply Likes
Hi,

Thanks for your help. I was able to sucessfully publish the application on the android market.

However, "Package file was not signed correctly" This is the error message I am getting after I download and tried to install the app. I did the signing using the keytool and jarsigner.

Here is my app for your reference - https://market.android.com/details?id...

Thanks,
Photo of tellmemore

tellmemore

  • 5 Posts
  • 0 Reply Likes
I have the same problem, I have spent all day trying to update our app on google play / android market .. whatever it's called now.
The last time I compiled the app for android through phonegap build I did not set a versionCode in my config.xml but looking at my google play developer console it came through with a versionCode of 5.
Now when I try to compile my update on phonegap build I figured that I could set the versionCode attribute in the config.xml to 6 and it would work.
But all I keep getting when trying to upload to google play is :
"The new apk's versionCode (5) already exists."

Arrrgh! Please can someone help me.!
Photo of stevenbenjaminaz

stevenbenjaminaz

  • 2 Posts
  • 0 Reply Likes
You can always manually set the android:versionCode to the next highest integer before submitting to the Play Store.
Photo of Jumpod Plekhongthu

Jumpod Plekhongthu

  • 2 Posts
  • 0 Reply Likes
i find this problem too.
My version code in Google Play is "1"
I have change in Manifest.xml to "3", it is not help.
I also try to change in build.gradle to "4", also not help.
Photo of Aravinth A

Aravinth A

  • 22 Posts
  • 0 Reply Likes
Hi..

When i change the version in config.xml(version 2.1.0) manifest.xml(android:versionName="0.0.1") after install in my device still it shows the 0.0.1 not 2.1.0 .Please guide me .

Thank you..