Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Xamarin.Android.Build.Tasks] Fix Android Version Code for Release builds #7795

Merged
merged 4 commits into from
Mar 27, 2023

Conversation

dellis1972
Copy link
Contributor

Fixes dotnet/maui#11139

Users trying to use maui and the new ApplicationVersion in conjunction with AndroidCreatePackagePerAbi find that the version is NOT used in the final set of apks.

This is because when we use AndroidCreatePackagePerAbi we are totally ignoring the ApplicationVersion number. Instead we pick up the one from the AndroidManifest.xml android:versionCode. For maui users This is not obvious and is counter intuitive.

So lets use the ApplicationVersion when using AndroidCreatePackagePerAbi. All the old code will remain in place, if the ApplicationVersion is not set we will still fall back to android:versionCode and if that is not set default to 1.

@dellis1972
Copy link
Contributor Author

@jonathanpeppers Hmm, this did not seem to break any tests 🤔

Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say we just make this change and not worry too much.

But we should add a test showing what was broken before?

@dellis1972
Copy link
Contributor Author

But we should add a test showing what was broken before?
Yup I'll get that sorted.

Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reran some tests to see if they turn green.

…ilds

Fixes dotnet/maui#11139

Users trying to use `maui` and the new `ApplicationVersion` in
conjunction with `AndroidCreatePackagePerAbi` find that the version
is NOT used in the final set of apks.

This is because when we use `AndroidCreatePackagePerAbi` we are totally
ignoring the `ApplicationVersion` number. Instead we pick up the one
from the `AndroidManifest.xml` `android:versionCode`. For maui users This
is not obvious and is counter intuitive.

So lets use the `ApplicationVersion` when using `AndroidCreatePackagePerAbi`.
All the old code will remain in place, if the `ApplicationVersion` is
not set we will still fall back to `android:versionCode` and if that is
not set default to `1`.
@dellis1972 dellis1972 merged commit 1bdcf9f into dotnet:main Mar 27, 2023
@dellis1972 dellis1972 deleted the maui11139 branch March 27, 2023 15:31
grendello added a commit to grendello/xamarin-android that referenced this pull request Mar 28, 2023
* main:
  [Xamarin.Android.Build.Tasks] Fix Android Version Code for Release builds (dotnet#7795)
grendello added a commit to grendello/xamarin-android that referenced this pull request Apr 6, 2023
* main: (94 commits)
  [ci] Remove remaining Classic test jobs. (dotnet#7924)
  Add Nightly Tests for Humanizer
  [readme] Add aka.ms links for d17.5. (dotnet#7935)
  [tests] Remove `net472` multitargeting (dotnet#7932)
  [monodroid] Fix `ld` build error on Nightly Builds. (dotnet#7925)
  Bump to xamarin/Java.Interop/main@0355acf (dotnet#7931)
  [tests] Use msftconnecttest.com in QuoteInvalidQuoteUrlsShouldWork (dotnet#7919)
  [ci] Don't set demands for megapipeline (dotnet#7929)
  [Mono.Android] Bind API-UpsideDownCake Developer Preview 1 (dotnet#7796)
  Bump to dotnet/installer@d109cba3ff 8.0.100-preview.4.23176.5 (dotnet#7921)
  [Xamarin.Android.Build.Tasks] Fix Android Version Code for Release builds (dotnet#7795)
  Bump to dotnet/installer@27d6769dfb 8.0.100-preview.4.23172.16 (dotnet#7910)
  [Xamarin.Android.Build.Tasks] Fix native code generation when marshal methods are disabled (dotnet#7899)
  [ci] Optimize 'APK's .NET' test job overhead. (dotnet#7904)
  [Mono.Android] delay JNINativeWrapper.get_runtime_types() (dotnet#7913)
  Bump external/Java.Interop from `73ebad2` to `53bfb4a` (dotnet#7914)
  [build] remove .NET 6 support (dotnet#7900)
  [profiled-aot] update `dotnet.aotprofile` for .NET 8 (dotnet#7908)
  [tests] Add backup ssl sites in case of 429 response. (dotnet#7909)
  $(AndroidPackVersionSuffix)=preview.4; net8 is 34.0.0-preview.4 (dotnet#7912)
  ...
@github-actions github-actions bot locked and limited conversation to collaborators Jan 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Android version code incorrect when publishing release build apk
2 participants