You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[One .NET] Fix RemoveResourceDesignerStep in .NET 6 (#6696)
Context: #6427
The current implementation of the `RemoveResourceDesignerStep` linker
step does not work under .NET 6. This is mostly down to the fact
that we didn't `override` the require methods to make it work in that
environment.
Reworks `RemoveResourceDesignerStep` to split some of the
functionality out into a new `LinkDesignerBase` base class.
`LinkDesignerBase` will be used in the future by the Resource Assembly
linker step #6427.
`.apk` size difference in a Basic Android Application shows a
effectively no reduction in Package size. This is a single App Head
project with no additional libraries or Nuget references:
Size difference in bytes ([*1] apk1 only, [*2] apk2 only):
- 596 assemblies/assemblies.blob
- 760 lib/x86/libaot-DotNet6AndroidBasic.dll.so
- 764 lib/armeabi-v7a/libaot-DotNet6AndroidBasic.dll.so
- 864 lib/x86_64/libaot-DotNet6AndroidBasic.dll.so
- 5,032 lib/arm64-v8a/libaot-DotNet6AndroidBasic.dll.so
Summary:
- 596 Other entries -0.03% (of 2,347,758)
+ 0 Dalvik executables 0.00% (of 333,284)
- 7,420 Shared libraries -0.03% (of 23,525,172)
+ 0 Package size difference 0.00% (of 11,745,501)
`.apk` size difference in a Basic Android app which references
AndroidX, shows a Package size reduction of ~164Kb. This example
includes an App Head project as well as a single Android Library
project. Both projects contain 2-3 `@(AndroidResource)` items and
both reference AndroidX. `Resource.Designer.cs` file is 460kb in size.
Size difference in bytes ([*1] apk1 only, [*2] apk2 only):
- 63,664 lib/x86/libaot-DotNet6AndroidTest.App.dll.so
- 63,952 lib/x86_64/libaot-DotNet6AndroidTest.App.dll.so
- 83,900 assemblies/assemblies.blob
- 84,408 lib/arm64-v8a/libaot-DotNet6AndroidTest.App.dll.so
- 92,340 lib/armeabi-v7a/libaot-DotNet6AndroidTest.App.dll.so
Summary:
- 83,900 Other entries -2.83% (of 2,965,109)
+ 0 Dalvik executables 0.00% (of 959,460)
- 304,364 Shared libraries -1.28% (of 23,781,188)
- 163,840 Package size difference -1.30% (of 12,620,512)
`.apk` size difference for a Basic Maui application shows a
Package size reduction of ~168Kb. This is just a standard
`dotnet new maui` app built for the Android platform:
Size difference in bytes ([*1] apk1 only, [*2] apk2 only):
+ 24 lib/arm64-v8a/libaot-Microsoft.Maui.Graphics.dll.so
- 48 lib/arm64-v8a/libaot-Microsoft.Maui.Controls.Xaml.dll.so
- 396 lib/armeabi-v7a/libaot-Microsoft.Maui.dll.so
- 448 lib/arm64-v8a/libaot-Microsoft.Maui.dll.so
- 536 lib/x86/libaot-Microsoft.Maui.Controls.Compatibility.dll.so
- 592 lib/x86_64/libaot-Microsoft.Maui.Controls.Compatibility.dll.so
- 632 lib/armeabi-v7a/libaot-Microsoft.Maui.Controls.dll.so
- 632 lib/x86/libaot-Microsoft.Maui.Controls.dll.so
- 720 lib/x86_64/libaot-Microsoft.Maui.Controls.dll.so
- 4,492 lib/x86/libaot-Microsoft.Maui.dll.so
- 4,544 lib/x86_64/libaot-Microsoft.Maui.dll.so
- 4,568 lib/arm64-v8a/libaot-Microsoft.Maui.Controls.Compatibility.dll.so
- 4,628 lib/armeabi-v7a/libaot-Microsoft.Maui.Controls.Compatibility.dll.so
- 4,792 lib/arm64-v8a/libaot-Microsoft.Maui.Controls.dll.so
- 26,676 lib/x86/libaot-BasicMauiApp.dll.so
- 27,000 lib/x86_64/libaot-BasicMauiApp.dll.so
- 30,772 lib/armeabi-v7a/libaot-BasicMauiApp.dll.so
- 31,096 lib/arm64-v8a/libaot-BasicMauiApp.dll.so
- 124,129 assemblies/assemblies.blob
Summary:
- 124,129 Other entries -1.18% (of 10,513,973)
+ 0 Dalvik executables 0.00% (of 6,459,432)
- 142,548 Shared libraries -0.28% (of 51,768,960)
- 167,936 Package size difference -0.57% (of 29,604,197)
For Android applications which make use of lots of resources, these
changes can also impact startup times. The follow are the start up
improvements on the Android Application and Library projects, both of
which use AndroidX.
| Before (ms) | After (ms) | Δ (%) | Notes |
| ----------: | ----------: | --------: | ------------------------------------ |
| 188.500 | 176.150 | -6.55% ✓ | defaults; 32-bit build |
| 174.150 | 175.100 | +0.54% ✗ | defaults; profiled AOT; 32-bit build |
| 187.550 | 178.300 | -4.93% ✓ | defaults; full AOT; 32-bit build |
| 173.250 | 174.050 | +0.46% ✗ | defaults; 64-bit build |
| 186.400 | 176.450 | -5.34% ✓ | defaults; profiled AOT; 64-bit build |
| 181.350 | 174.400 | -3.83% ✓ | defaults; full AOT; 64-bit build |
~~ Known Issues ~~
`RemoveResourceDesignerStep` doesn't work properly with array
resources; consider:
int iconDimen = Resource.Styleable.AlertDialog[Resource.Styleable.AlertDialog_buttonIconDimen];
The `RemoveResourceDesignerStep` will *remove* the
`Resource.Styleable.AlertDialog` field, but the field is still
accessed (?!), resulting in a `BadImageFormatException` at runtime:
android.runtime.JavaProxyThrowable: System.BadImageFormatException: Could not resolve field token 0x0400052b
Copy file name to clipboardExpand all lines: src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets
0 commit comments