Bug 53368 - Android Version Code Not Incrementing From AndroidManifest.xml
Summary: Android Version Code Not Incrementing From AndroidManifest.xml
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 7.1 (C9)
Hardware: PC Mac OS
: Normal normal
Target Milestone: 15.4
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2017-03-15 17:47 UTC by Jayden Spring
Modified: 2017-06-08 16:05 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_REPRODUCIBLE

Description Jayden Spring 2017-03-15 17:47:20 UTC
After installing the latest updates to XS today, I went to deploy a new version of my Android app to the Alpha channel on Google Play to test in app purchases. The version currently there had a versionCode of 111 and a versionName of 0.0.1. 

I incremented the versionCode in the AndroidManifest, archived it for publishing in the Release configuration and then went to submit it to Google Play through the archive manager. However it came back saying "Error uploading '....' A APK with version code (111) has already been uploaded'. I tried uploading the signed APK manually in case for some reason the archive manager was using an older one - but same result.

After exhausting most avenues on SO and Google I noticed there was a Xamarin slack channel so jumped in there and posted a question to be helped by Jon Douglas.

We ended up doing an aapt dump on the signed apk which revealed that the versionCode in it was still 111 although the version code in the project/Properties/AndroidManifest.xml and obj/Release/android/AndroidManfiest.xml were showing as 112.

Jon instructed me to use msbuild to sign and recompile and submit the APK manually. Following the instructions here (https://developer.xamarin.com/guides/android/under_the_hood/build_process/#Signing_Properties) that Jon directed me to, MSBuild didn't like the KeyStore property group - so I ended up using the unsigned version MSBuild generated, using jarsigner and then zipalign to produce the end result - which Google Play accepted.

The MSBuild part of the issue is most likely me - but thought I would leave that in.


XS Information:
=== Xamarin Studio Community ===

Version 6.2 (build 1829)
Installation UUID: 0eeecbe7-3390-4572-8505-59100d825f7e
Runtime:
	Mono 4.8.0 (mono-4.8.0-branch/8f6d0f6) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 408000520

=== NuGet ===

Version: 3.5.0.0

=== Xamarin.Profiler ===

Version: 1.2.1
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.2.1 (11766.1)
Build 8C1002

=== Xamarin.iOS ===

Version: 10.4.0.128 (Xamarin Studio Community)
Hash: ba11e48
Branch: cycle9
Build date: 2017-03-10 08:48:04-0500

=== Xamarin.Android ===

Version: 7.1.0.43 (Xamarin Studio Community)
Android SDK: /Users/Jayden/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)
		7.0   (API level 24)
		7.1   (API level 25)

SDK Tools Version: 25.2.4
SDK Platform Tools Version: 25.0.3
SDK Build Tools Version: 23.0.1

Java SDK: /usr
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 3.0.0.398 (Xamarin Studio Community)

=== Xamarin Inspector ===

Not Installed

=== Build Information ===

Release ID: 602001829
Git revision: 3a28108feb03a6384702c96ffc8c548121cdf37c
Build date: 2017-03-12 06:55:23-04
Xamarin addins: 295d27f8dcdde049a1807a76c888fc0a6557357d
Build lane: monodevelop-lion-cycle9

=== Operating System ===

Mac OS X 10.12.3
Darwin Jaydens-5K-iMac.local 16.4.0 Darwin Kernel Version 16.4.0
    Thu Dec 22 22:53:21 PST 2016
    root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

WakaTime 2.0.2
JSON Copy 1.1
Gorilla Player 0.9.1.2
Comment 2 Greg Munn 2017-03-16 14:37:12 UTC
This is potentially a Xamarin.Android issue. Dean will take a look at it first.
Comment 3 dean.ellis 2017-03-16 17:37:31 UTC
The only way I seem to be able to repo this issue in a unit test is if the change is made to the manifest but the file is not saved. 

@greg Is it possible to get diagnostic build output for the Archive Manager build? Does it output the build results to the output window as normal?

If so can you attach the diagnostic build output? you can make sure its diagnostic by setting the value in 

Preferences->Projects->Build->Log Verbosity
Comment 4 Greg Munn 2017-03-16 17:46:59 UTC
alas, I don't think it does.
Comment 5 dean.ellis 2017-04-27 14:17:31 UTC
I am still unable to reproduce this issue. I have tried on the command line as in the latest XS and Xamarin.Android. Each time changing the VersionCode and then using Archive for Publishing produces an apk which has the correct code. I have tried with and without saving the changes and it automatically saves before running the build.

Jon are you in a position to repo this? If so do you have an additional information?
Comment 7 dean.ellis 2017-06-06 09:36:08 UTC
Any further information on this issue? I am still unable to replicate.
Comment 9 Jon Douglas [MSFT] 2017-06-08 16:05:14 UTC
Closing out this bug as the original reporter has let me know they haven't been able to reproduce this with the latest XVS / XA releases.