Cli-6.0.0 gives wrong Android version code when based on build number

  • 3
  • Problem
  • Updated 4 years ago
I use the build number as an automatic version code for Android releases. However building with the new cli-6.0.0 gives the wrong version code. The build number shows as 624 on PGB, but when I upload the APK to Google Play, it shows 6248. I tried building again, so my build number became 625. Once uploaded to Google Play it showed as 6258. So it seems the number 8 gets added (not mathematical addition, but plain text addition) at the end of the version code.

Building with cli-5.2.0 works fine. Uploaded build number 626 and it correctly shows in Google Play as version code 626.
Photo of Statens vegvesen Vegdirektoratet

Statens vegvesen Vegdirektoratet

  • 29 Posts
  • 0 Reply Likes

Posted 4 years ago

  • 3
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
That's what the gradle engine seems to do, for whatever reason.
Could you please try and set the phonegap-build-tool to 'ant', then rebuild?
Photo of Statens vegvesen Vegdirektoratet

Statens vegvesen Vegdirektoratet

  • 29 Posts
  • 0 Reply Likes
I first tried with

That didn't do any difference, still that extra 8 in the end, so I tried with what I found in a blog post

That made the build fail with the this log
http://pastebin.com/D6HHPr6X

Which preference was correct?
When can we expect a fix for the problem?
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes

That made the build fail with the this log
Doesn't look like a failing build. It says BUILD SUCCESSFUL.

Which preference was correct?
Can't tell. Your code didn't show. Use a CODE element around your code as described under "some HTML allowed".

When can we expect a fix for the problem?
There is a bug report for this at the PGB Github, dated October 2015. No progress.
https://github.com/phonegap/build/iss...
Not likely to see any solution, soon.
Photo of Statens vegvesen Vegdirektoratet

Statens vegvesen Vegdirektoratet

  • 29 Posts
  • 0 Reply Likes
How strange, I didn't read the log very well, but I'm certain the build showed as failed after building.

It's also strange with the bug report from October, as cli-6.0.0 was released this month.
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
When posting code, please post your config.xml.
Please use some HTML (like <code></code>). (see attached image)

Photo of Statens vegvesen Vegdirektoratet

Statens vegvesen Vegdirektoratet

  • 29 Posts
  • 0 Reply Likes
I wasn't aware of that. Thank you!
Photo of ryan

ryan, Developer

  • 1538 Posts
  • 132 Reply Likes
Photo of Statens vegvesen Vegdirektoratet

Statens vegvesen Vegdirektoratet

  • 29 Posts
  • 0 Reply Likes
Thank you, that does seem to explain why this happens. Although it's a horrible "solution" as it messes with peoples releases to Google Play.
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
This 'solution' immediately causes severe trouble. That's not acceptable.
Photo of ryan

ryan, Developer

  • 1538 Posts
  • 132 Reply Likes
Wasn't meant as a solution, just showing for reference why its happening. PGB is a consumer of the cordova project and we'll unavoidably be victim to some of that project's choices. That said I'll look into a workaround.
Photo of Statens vegvesen Vegdirektoratet

Statens vegvesen Vegdirektoratet

  • 29 Posts
  • 0 Reply Likes
I think both Petra and I refered to the solution chosen to solve the problem with multi-arch builds requiring different version codes, when stating it was a bad solution. Your post here was indeed a good response to explain why it's happening :)
Photo of gkatz

gkatz

  • 186 Posts
  • 5 Reply Likes
@ryan;
I dont understand what Im supposed to to now.
see the picture I attached below in a post from yesterday.
should I do whats written here:
http://stackoverflow.com/questions/16...
I need to know a way that will 100% make sure my users will get an update and that PGB new versioning system does not impact that.
please advise ASAP
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
That's a good find!
If this is really the issue,
a. Google worded that error message really badly
b. the issue has nothing to do with gradle.
Photo of gkatz

gkatz

  • 186 Posts
  • 5 Reply Likes
@Petra, I'm still terrified that I would do something that we cause my users not to get the update...
this is why I'd be happy if someone can shed light on this by sharing his experience. meaning he did encountered the problem, did whats stated in the stackoverflow post I suggested earlier and his users got the update for the app as a regular update
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Yes, I understand that very well. Unfortunately, I can't help you, since I never experienced this myself.
Since you are in a hurry, wouldn't you want to try shouting at PGB on Twitter? They might get alerted, then.
Photo of gkatz

gkatz

  • 186 Posts
  • 5 Reply Likes
well I dont have a twitter account :) maybe I would open one.
whats the PGB guys twitter?
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Photo of gkatz

gkatz

  • 186 Posts
  • 5 Reply Likes
guys i am also having this same problem and probably many others too.
so what is the proper way to tackle this?
I need to upload a new version to google play and getting the attached picture as a result. needless to say my version code in the config xml is 32 and not 328.
what should I do in order to publish the app? and of course have the playstore tell users that they have an update...
thanks for your time
BTW, I am using cli 6 with gradle. tried simply moving to ANT but the PGB portal states the build fails (even though the log does not show errors), reverted back to gradle and the build passed fine
Photo of gkatz

gkatz

  • 186 Posts
  • 5 Reply Likes
could really use your help on this one guys.
how did everyone bypass this?
thanks!
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Well, my 'solution' is to temporarily not use gradle, until they found a better way to cope with multi-arch builds.
:-(
Photo of gkatz

gkatz

  • 186 Posts
  • 5 Reply Likes
well....
problem is i cant build with ant... I get the "Oh geez. Your build failed. Sorry, but a problem occurred on the build server"
even though like I said I dont see any problems in the log, all I see is: "BUILD SUCCESSFUL

Total time: 47.789 secs
Built the following apk(s):
/project/build/outputs/apk/project-release-unsigned.apk" in the end
my app ID is 544921
can someone please assist?
thanks!
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
"project-release-unsigned.apk"
This sounds very strange to me. How can a release project be unsigned?
Photo of gkatz

gkatz

  • 186 Posts
  • 5 Reply Likes
I guess this might be another issue. I will open a new post and let this post remain with its original intention. It is very strange that they will not fix this and will not provide doc to explain what we can do. they closed the bug as wont_fix. I dont get it...
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
It is very strange that they will not fix this and will not provide doc to explain what we can do. they closed the bug as wont_fix.

Based upon what Ryan wrote above, they don't consider it a bug. The PGB team might not fully understand the consequences, though.
Photo of ryan

ryan, Developer

  • 1538 Posts
  • 132 Reply Likes
We've just deployed an update to Build which overrides the versionCode. Use the following in your config.xml:

<preference name="android-versionCode" value="1234" />

and this should override the gradle versioning issues. Let me know if it works for you.
Photo of gkatz

gkatz

  • 186 Posts
  • 5 Reply Likes
thanks, will let you know in a day or two when I get in front of my dev machine again.
Photo of gkatz

gkatz

  • 186 Posts
  • 5 Reply Likes
Hi all;
so I have used the preference above and the version code is fine.
I already published my app update and verified that it is pushed as an update to my app users.
thanks
Photo of Hans Mosselaer

Hans Mosselaer

  • 9 Posts
  • 0 Reply Likes
This is NOT the solution, i just found out the same and reported a new ticket, so please get it solved for new people, thank you.