3

This is quite a weird one.

Basically, I decided to switch from using trigger.io to using cordova to build and compile my app (using ionic framework).

Everything is fine if I build an unsigned and unaligned app, but for production I have to sign and align the apk in order to upload it on the play store.

I have signed and aligned the apk properly, but when I tried to upload the apk, I got this error:

Your APK version code needs to be greater than 1457108319

Now, I read a couple of answers here on stack overflow saying that I just need to add this line in my project config.xml file:

<widget id="com.***********" android-versionCode="1457108319" version="5.0.0"

but the problem is that if I had this line of code, then gradle fails and I get this error:

Error: Error code 1 for command: cmd with args: /s,/c,"c:\src\app-v5\platforms\android\gradlew cdvBuildRelease -b c:\src\app-v5\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"

Hovewer, if I change the versionCode to a 6 digit code instead of 10, I get no error, but again, I can't upload it to the store because the versionCode number is less than the app already released.

How can I solve this? I really have no idea what to do.

Thanks a lot

Nick
  • 13,493
  • 8
  • 51
  • 98

2 Answers2

3

I actually resolved this. I had to add to my config.xml file the following (in <widget>, right after version):

android-versionCode="{this needs to be replaced, in my case, by the current timestamp "

The downside is that I have to remember to put the new timestamp everytime for now.

I will, at some point, write some kind of script to do this for me.

Hope this helps someone

Nick
  • 13,493
  • 8
  • 51
  • 98
2

I had the same problem since updating to latest Cordova CLI (6.3.1) and latest android platform for cordova (5.2.2).

My old build had the following: versionCode: 69000 from the config.xml file:

My new buid: versionCode: 7000 from the config.xml file:

so when I upload the signed APK to the PlayStore I get the same error you had:

the problem is that 7000 is < to 69000

The issue comes from the gradle script (in platforms/android/build.gradle) which from what I understand generates the versionCode from what he finds in your config.xml.

Looks like it is missing some multiplication by 100 somewhere:

so far here is what can be done: 1: instead of using 0.70 as version number use 0.700 2: specify the versionCode in the config.xml file :

it worked for me in both cases.

Hope it helps.