-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Android version code incorrect when publishing release build apk #11139
Comments
I set the <?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="40"
android:versionName="1.3.0"
>
<application
android:allowBackup="true"
android:label="AppName"
android:icon="@mipmap/appicon"
android:roundIcon="@mipmap/appicon_round"
android:supportsRtl="true"
android:networkSecurityConfig="@xml/network_security_config"
>
<!-- Xam.Plugins.Messaging -->
<!--android:name="android.support.v4.content.FileProvider"-->
<provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" />
</provider>
</application>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
</manifest> |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
I also have this issue and I'm not using Maui, but Xamarin Forms. The Android app when built in release mode will completely ignore android:versionCode="1" android:versionName="0.0.1" inside AndroidManifest.xml and set them to 1 and 1.0.0 respectively. Another point that might be worth mentioning is that this happens when building locally, and on Azure DevOps. |
This is a comment from the docs at https://github.com/xamarin/xamarin-android/blob/main/Documentation/guides/building-apps/build-properties.md#androidversioncode
That said, having the value be derived from In the meantime I have found that by setting the |
…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`.
…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`.
…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`.
…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`.
…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`.
…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`.
…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`.
…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`.
…ilds (#7795) * [Xamarin.Android.Build.Tasks] Fix Android Version Code for Release builds 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`.
Description
There is no appearent way to set Version Code to other than 1 inside .cproj. whatever version number you put in code.
When you hit Publish release version you get an apk with Version Code 1.
Context:
Related to #3690.
Environment:
Microsoft Visual Studio Community 2022
Version 17.3.6
VisualStudio.17.Release/17.3.6+32929.385
Xamarin.Android SDK 13.0.0.0 (d17-3/030cd63)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: dffa5ab
Java.Interop: xamarin/java.interop/d17-3@7716ae53
SQLite: xamarin/sqlite@df4deab
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@14076a6
Project:
Steps to Reproduce
Select local Android device as target, build configuration Release, hit Publish. but before:
A:
after Publish in VS for windows this results in:
Version Code 1
B:
after Publish in VS for windows this results in:
Version Code 1
As you can see there is no appearent way to set Version Code to other than 1 inside .cproj
Link to public reproduction project repository
https://github.com/taublast/MauiDroidVersionCodeBug/
Version with bug
6.0.486 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
et6.0-android
Did you find any workaround?
No.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: