Update "android:versionCode" to redeploy APK

I used the wrong command for jarsigner and need to rerun it. The new command I’m using is this:

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -tsa http://timestamp.digicert.com -keystore <keystore-name> unaligned.apk <app-name>
jarsigner -verify -verbose -certs unaligned.apk

I’m unable to upload a new APK because I get this error in the Play Dev Console:

You need to use a different version code for your APK because you already have one with version code 10000.

You can change android:versionCode in AndroidManifest.xml to 10001 and rebuild with gradle, but I’m not able to find the command Meteor uses to build the unaligned.apk file again. The alternative is to just change the version number to 1.0.1 and reupload but I’d rather not change the versionName since it doesn’t need to match versionCode. Any suggestions?

1 Like

Bump: https://stackoverflow.com/questions/32179872/meteor-js-android-version-code

Any suggestions?

1 Like

I think I ended up bumping the entire version.

1 Like

I ran into this issue too :frowning: . We have old versions from a previous developer who have Android Version Names as 2x,xxx.0.0 and Version Numbers as small integers (1,2,3,4,etc). Now we come along with Meteor and are forced to push version 30000.0.0 (mainly because of iOS version the prev dev screwed u too). Our Android version name/number becomes 3000000 (3 million), and Android spits back and says FU!

I need fine grain control over the ver name and number!! ahhh

Manually changing the manifest is not an option in this case.

DUH, why did I not think of using the /cordova-build-override/ folder.

Solution is to pass values to build-extras.gradle. You can read more here Android Shell Tool Guide.

My /cordova-build-override/platforms/android/build-extras.gradle

cdvVersionCode = '10'
android {
  lintOptions {
      disable 'MissingTranslation'
      disable 'ExtraTranslation'
  }
}
2 Likes

I was looking for an answer for almost an hour. Happy I found your solution!

To make things a bit clearer, here are links to the Cordova documentation and the Meteor Wiki which explain what’s going on in a bit more detail.

I actually use a shell script /project-name/build.sh to build my iOS and Android and do deploy my web app with meteor-up. Here is a short excerpt specifically targeting the Android version number issue:

#!/bin/sh

# get the current git revision which we will be using for the iOS and Android build number
REVISION=$(git rev-list HEAD --count)
echo 'BUILD NUMBER' $REVISION

# set the current build number for Android
echo "cdvVersionCode = '1000$REVISION'" > ./cordova-build-override/platforms/android/build-extras.gradle

# build for iOS and Android
meteor build ./build/ --server=$SERVER
2 Likes