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
VS 16.3.0 regression: Inconsistent <AndroidStoreUncompressedFileExtensions> response. #3675
Comments
I'll be looking to identify how to provoke this in a simple test case, but wanted to get the issue on record in case it rings a bell with anyone. Additionally, what would be easier for us (feature request, ultimately) is an ability to specify uncompressed storage requests on a per-AndroidAsset basis vs. having to accomplish this by adopting file extension conventions that we then have to amend AndroidStoreUncompressedFileExtensions to honor. We have NuGet packages that perform asset conditioning that result in additional AndroidAsset additions to the client project---it'd be more natural to simply add these with an additional field (e.g. Uncompressed="True") vs. having to constrain the paths to a known extension we then register for raw storage. The set of uncompressed assets stored in the APK would then be the union of those that match AndroidStoreUncompressedFileExtensions contents and those explicitly specified individually (no matter their extension). In the regression case, we have identical patterns of NuGet package-registered assets (and corresponding AndroidStoreUncompressedFileExtensions amendments) in multiple packages in use by the client and yet see both stored (proper) and deflated (improper) outcomes at the same time in the resulting APK. A puzzle. |
Example partial listing of an affected
...for an aggregate Both the Note that the first asset is stored and the second deflated. The second is incorrect (and a consequence of the VS 16.3 upgrade, apparently). |
After failing to get any asset to store uncompressed in even a simplified form, I find even the following fails to do what's expected:
Result: The text file is deflated in the APK. Is it possible that the leave-uncompressed feature is broken or changed in what it covers? |
I do also see a change in compression behavior between d16-2 and d16-3 with the simple repro steps mentioned above. I'm attaching a repro project and binlogs from d16-2 and d16-3: |
Looks like we are missing |
I think we need this
|
I'd also suggest a unit test of some kind to ensure no future regression. |
We have a unit test, not sure it is running against aapt2. |
Since its not the full default at the moment afaik |
Fixes: #3675 `<Aapt2Link>` didn't use `$(AndroidStoreUncompressedFileExtensions)` at all 🤦♂. Consequently, if `$(AndroidUseAapt2)`=True and `$(AndroidStoreUncompressedFileExtensions)` was set, files with the specified file extensions would *not* be stored uncompressed within the resulting `.apk`. This was presumably overlooked and missed when [`aapt2` was enabled by default in d16-3][0]. Update the `<Aapt2Link>` invocation so that `$(AndroidStoreUncompressedFileExtensions)` is provided, which in turn allows `aapt2` output to *not* compress files with the specified file extensions. Check that this works by updating `PackagingTest.CheckIncludedNativeLibraries()`, and requiring that `.so` files be stored uncompressed when `$(AndroidStoreUncompressedFileExtensions)`=`.so`. [0]: https://docs.microsoft.com/en-us/xamarin/android/release-notes/9/9.4#aapt2-enabled-by-default-for-new-projects
Fixes: #3675 `<Aapt2Link>` didn't use `$(AndroidStoreUncompressedFileExtensions)` at all 🤦♂. Consequently, if `$(AndroidUseAapt2)`=True and `$(AndroidStoreUncompressedFileExtensions)` was set, files with the specified file extensions would *not* be stored uncompressed within the resulting `.apk`. This was presumably overlooked and missed when [`aapt2` was enabled by default in d16-3][0]. Update the `<Aapt2Link>` invocation so that `$(AndroidStoreUncompressedFileExtensions)` is provided, which in turn allows `aapt2` output to *not* compress files with the specified file extensions. Check that this works by updating `PackagingTest.CheckIncludedNativeLibraries()`, and requiring that `.so` files be stored uncompressed when `$(AndroidStoreUncompressedFileExtensions)`=`.so`. [0]: https://docs.microsoft.com/en-us/xamarin/android/release-notes/9/9.4#aapt2-enabled-by-default-for-new-projects
Release status update A new Preview version has now been published that includes the fix for this item. The fix is not yet included in a Release version. I will update this item again when a Release version is available that includes the fix. Fix included in Xamarin.Android 10.1.0.1. Fix included on Windows in Visual Studio 2019 version 16.4 Preview 2. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview. Fix included on macOS in Visual Studio 2019 for Mac version 8.4 Preview 1. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel. |
Any Update on when this appears in a release? We want to release our app but prefer to work with the Release update channel, and this bug breaks our app. |
@wolpers a workaround would be to use |
Release status update A new Release version has now been published on Windows that includes the fix for this item. The fix is not yet published in a Release version on macOS. I will update this item again when a Release version is available on macOS that includes the fix. Fix included in Xamarin.Android 10.1.0.30. Fix included on Windows in Visual Studio 2019 version 16.4. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/. (Fix also included on macOS in Visual Studio 2019 for Mac version 8.4 Preview 2.1 and higher. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.) |
I'm still seeing the issue described originally above (mix of stored vs. deflated despite both extensions in play) under 10.1.0.30. I'll try and get additional information. |
Confirmed that this still does not appear to be fully fixed. I've attached a simple project that has the conditions originally described (multiple extensions set for raw storage). After building under 10.1.0.30, with
...where with
The correct outcome is both files Note that the extensions list in this case has a leading semicolon---this is due to |
@dellis1972 you should try this ^^ It's weird it seems like it doesn't like the |
The docs for aapt2 say
which suggests we are passing it the correct arguments (in this case |
we are passing the correct arguments to
Which is weird and odd behaviour. But its within aapt2 itself. So there isn't much we can do about that particular case :/ |
Good catch. Specifying full compound extensions will certainly work for us. Thanks again for the overall fix. |
Release status update A new Release version has now been published on macOS that includes the fix for this item, as was published earlier on Windows. Fix included in Xamarin.Android 10.1.1.0. Fix included on macOS in Visual Studio 2019 for Mac version 8.4. To get the new version that includes the fix, check for the latest updates on the Stable updater channel. (Fix also included on Windows in Visual Studio 2019 version 16.4 and higher. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/.) |
Steps to Reproduce
(Working on a viable compact test case.)
Expected Behavior
In all cases, specified AndroidStoreUncompressedFileExtensions contents (either in app project or from NuGet package .targets files that amend the property) are properly honored at APK creation time.
Actual Behavior
As of VS 16.3.0, we now see (in the same APK) cases where assets are stored (as requested) and others deflated (despite being specified for uncompressed storage).
Version Information
Xamarin.Android SDK 10.0.0.43 (d16-3/8af1ca8)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: mono/mono@7af64d1ebe9
Java.Interop: xamarin/java.interop@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip@b95cf3f
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools@cb41333
The text was updated successfully, but these errors were encountered: