-
Notifications
You must be signed in to change notification settings - Fork 531
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
[Bug] Resx files don't work with Android App Bundle #3596
Comments
I have the same issue. Any workaround? |
Fixes: dotnet#3596 Context: https://github.com/google/bundletool/blob/2e9ac4e628a690c0fce402548fe90c747c86533c/src/main/proto/config.proto#L22-L25 We got report of `.resx` files not working with Android App Bundles. Sure enough, when I tried the sample: https://docs.microsoft.com/en-us/samples/xamarin/xamarin-forms-samples/usingresxlocalization/ I was not seeing Spanish localization when running the app... So I pulled the app bundle from the device: > adb shell pm list packages -f | Select-String UsingResxLocalization.Android package:/data/app/UsingResxLocalization.Android-VGGyQ6woBTkNUy4HJ8WqmQ==/base.apk=UsingResxLocalization.Android > adb pull /data/app/UsingResxLocalization.Android-VGGyQ6woBTkNUy4HJ8WqmQ==/base.apk /data/app/UsingResxLocalization.Android-VGGyQ6woBTkNUy4HJ8WqmQ==/base.apk: 1 file pulled. 35.1 MB/s (12330445 bytes in 0.335s) And then discovered that all of the localization assemblies were compressed! > 7z l base.apk ... Size Compressed Name ----- ------------ ------------ 14848 14848 assemblies\UsingResxLocalization.dll 3584 1279 assemblies\de-CH\UsingResxLocalization.resources.dll 3584 1275 assemblies\de\UsingResxLocalization.resources.dll 3584 1306 assemblies\es\UsingResxLocalization.resources.dll 3584 1273 assemblies\fr\UsingResxLocalization.resources.dll 3584 1286 assemblies\id\UsingResxLocalization.resources.dll 3584 1348 assemblies\ja\UsingResxLocalization.resources.dll 3584 1280 assemblies\ms\UsingResxLocalization.resources.dll 3584 1302 assemblies\pt-BR\UsingResxLocalization.resources.dll 3584 1301 assemblies\pt\UsingResxLocalization.resources.dll 3584 1288 assemblies\zh-Hans\UsingResxLocalization.resources.dll 3584 1288 assemblies\zh-Hant\UsingResxLocalization.resources.dll Looking the file structure of the `base.apk`, we had an incorrect wildcard for `BundleConfig.json`: assemblies/* It needs to be `assemblies/**`, so sub-directories will work. I added a project with `.resx` files to `BundleToolTests` and some assertions to ensure all .NET assemblies remain uncompressed in Android App Bundles.
Fixes: #3596 Context: https://github.com/google/bundletool/blob/2e9ac4e628a690c0fce402548fe90c747c86533c/src/main/proto/config.proto#L22-L25 We got report of `.resx` files not working with Android App Bundles. Sure enough, when I tried the sample: https://docs.microsoft.com/en-us/samples/xamarin/xamarin-forms-samples/usingresxlocalization/ I was not seeing Spanish localization when running the app... So I pulled the app bundle from the device: > adb shell pm list packages -f | Select-String UsingResxLocalization.Android package:/data/app/UsingResxLocalization.Android-VGGyQ6woBTkNUy4HJ8WqmQ==/base.apk=UsingResxLocalization.Android > adb pull /data/app/UsingResxLocalization.Android-VGGyQ6woBTkNUy4HJ8WqmQ==/base.apk /data/app/UsingResxLocalization.Android-VGGyQ6woBTkNUy4HJ8WqmQ==/base.apk: 1 file pulled. 35.1 MB/s (12330445 bytes in 0.335s) And then discovered that all of the localization assemblies were compressed! > 7z l base.apk ... Size Compressed Name ----- ------------ ------------ 14848 14848 assemblies\UsingResxLocalization.dll 3584 1279 assemblies\de-CH\UsingResxLocalization.resources.dll 3584 1275 assemblies\de\UsingResxLocalization.resources.dll 3584 1306 assemblies\es\UsingResxLocalization.resources.dll 3584 1273 assemblies\fr\UsingResxLocalization.resources.dll 3584 1286 assemblies\id\UsingResxLocalization.resources.dll 3584 1348 assemblies\ja\UsingResxLocalization.resources.dll 3584 1280 assemblies\ms\UsingResxLocalization.resources.dll 3584 1302 assemblies\pt-BR\UsingResxLocalization.resources.dll 3584 1301 assemblies\pt\UsingResxLocalization.resources.dll 3584 1288 assemblies\zh-Hans\UsingResxLocalization.resources.dll 3584 1288 assemblies\zh-Hant\UsingResxLocalization.resources.dll Looking the file structure of the `base.apk`, we had an incorrect wildcard for `BundleConfig.json`: assemblies/* It needs to be `assemblies/**`, so sub-directories will work. I added a project with `.resx` files to `BundleToolTests` and some assertions to ensure all .NET assemblies remain uncompressed in Android App Bundles.
Fixes: #3596 Context: https://github.com/google/bundletool/blob/2e9ac4e628a690c0fce402548fe90c747c86533c/src/main/proto/config.proto#L22-L25 We got report of `.resx` files not working with Android App Bundles. Sure enough, when I tried the sample: https://docs.microsoft.com/en-us/samples/xamarin/xamarin-forms-samples/usingresxlocalization/ I was not seeing Spanish localization when running the app... So I pulled the app bundle from the device: > adb shell pm list packages -f | Select-String UsingResxLocalization.Android package:/data/app/UsingResxLocalization.Android-VGGyQ6woBTkNUy4HJ8WqmQ==/base.apk=UsingResxLocalization.Android > adb pull /data/app/UsingResxLocalization.Android-VGGyQ6woBTkNUy4HJ8WqmQ==/base.apk /data/app/UsingResxLocalization.Android-VGGyQ6woBTkNUy4HJ8WqmQ==/base.apk: 1 file pulled. 35.1 MB/s (12330445 bytes in 0.335s) And then discovered that all of the localization assemblies were compressed! > 7z l base.apk ... Size Compressed Name ----- ------------ ------------ 14848 14848 assemblies\UsingResxLocalization.dll 3584 1279 assemblies\de-CH\UsingResxLocalization.resources.dll 3584 1275 assemblies\de\UsingResxLocalization.resources.dll 3584 1306 assemblies\es\UsingResxLocalization.resources.dll 3584 1273 assemblies\fr\UsingResxLocalization.resources.dll 3584 1286 assemblies\id\UsingResxLocalization.resources.dll 3584 1348 assemblies\ja\UsingResxLocalization.resources.dll 3584 1280 assemblies\ms\UsingResxLocalization.resources.dll 3584 1302 assemblies\pt-BR\UsingResxLocalization.resources.dll 3584 1301 assemblies\pt\UsingResxLocalization.resources.dll 3584 1288 assemblies\zh-Hans\UsingResxLocalization.resources.dll 3584 1288 assemblies\zh-Hant\UsingResxLocalization.resources.dll Looking the file structure of the `base.apk`, we had an incorrect wildcard for `BundleConfig.json`: assemblies/* It needs to be `assemblies/**`, so sub-directories will work. I added a project with `.resx` files to `BundleToolTests` and some assertions to ensure all .NET assemblies remain uncompressed in Android App Bundles.
@jonathanpeppers Is the fix available yet in a Xamarin.Android release, or is that still pending? |
It should be in a future Visual Studio 2019 16.4 release. I don’t think the release date is public quite yet. |
Does this solution have any side effects? is it not increasing bundle size? if i am not mistaken dlls were compressed into apk but now not in aab. is it not a step back? |
DLLs are not compressed, because mmap is used to load them into memory directly from the APK. I think we looked at allowing .NET assemblies to be compressed at one point, but it hurt startup performance. |
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. The fix is not yet available on macOS. I will update this item again when a Preview version with the fix is available on macOS. Fix included in Xamarin.Android 10.0.99.100. Fix included on Windows in Visual Studio 2019 version 16.4 Preview 1. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview. Fix not yet available on macOS. |
@brendanzagaeski As we are quite desperately looking forward to AAB publishing (mainly because of download sizes), we would appreciate it to see this issue in a hotfix Version of Xamarin.Android, as this issue is also listed in the "Known Issues" section of Xamarin.Android 10.0.0.43. |
@thisisthekap did the workaround work? #3596 (comment) |
I Confirm, the workaround works, mp3 files must also be included to work properly. |
@lahna200 there are 2 fixes for app bundles & compression in the next release (Xamarin.Android 10.1), but I bet this one will fix the mp3 issue: #3604 |
Release status update A new Preview version has now been published for macOS that includes the fix for this item. Fix included in Xamarin.Android 10.1.0.1. 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. |
Is there already a documentation or article about how to achieve app bundles step by step? |
I'm also blocked on this, eagerly waiting for the stable channel release fix to hit Azure DevOps so I can build in the cloud again! Building locally using the preview in the meantime. |
@andrewleader there is a workaround for this one: #3596 (comment) |
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.) |
Release status update A new Release version has now been published on macOS that includes the fix for this item. 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/.) |
@brendanzagaeski Does either not work or is a regressed bug. When starting the app in a German Simulator all texts show correctly in German. Anyone else experiencing this? |
@acuntex, thanks for the heads-up! If are using Xamarin.Android 10.3 in Visual Studio 2019 version 16.6 or Visual Studio 2019 for Mac version 8.6, one likely possible cause is #4664. If the workaround mentioned in that item does not resolve the issue for your project, then if you might be able to submit a new issue that has the diagnostic MSBuild output from your project zipped and attached so the team can take a look, that would be perfect. Thanks in advance! |
I can confirm that the workaround from #4664 worked. |
Description
If use Android App Bundle, then AppResource.de.resx and other don't work, but AppResource.resx work.
I use - this example
Steps to Reproduce
Expected Behavior
Changing the language in the program
Actual Behavior
The language in the program should change, but it does not change.
Basic Information
The text was updated successfully, but these errors were encountered: