Skip to content

Conversation

@jonathanpeppers
Copy link
Member

To keep app sizes down in the .NET 6 timeframe, we special-cased existing AndroidX and GPS packages so they were always trimmed.

Modern packages mark themselves trimmable with $(IsTrimmable) or the assembly-level attribute.

For nearly 2 years, we've applied the appropriate trimming setting in these packages:

We should be able to remove this now in .NET 9.

To keep app sizes down in the .NET 6 timeframe, we special-cased
existing AndroidX and GPS packages so they were always trimmed.

Modern packages mark themselves trimmable with `$(IsTrimmable)` or the
assembly-level attribute.

For nearly 2 years, we've applied the appropriate trimming setting in
these packages:

* dotnet/android-libraries#520
* xamarin/GooglePlayServicesComponents#597

We should be able to remove this now in .NET 9.
@jonathanpeppers
Copy link
Member Author

As anticipated:

Saving apk description to '/Users/runner/work/1/a/TestRelease/01-10_19.23.10/BuildReleaseArm64XFormsDotNet.apkdesc'
Size difference in bytes ([*1] apk1 only, [*2] apk2 only):
253,683 assemblies/Xamarin.AndroidX.Core.dll
179,063 assemblies/Xamarin.Google.Android.Material.dll
157,233 assemblies/Xamarin.AndroidX.AppCompat.dll
104,239 assemblies/Xamarin.AndroidX.Media.dll *2
 52,862 assemblies/Xamarin.AndroidX.Annotation.dll *2
 48,743 assemblies/Xamarin.AndroidX.RecyclerView.dll
 39,419 assemblies/Xamarin.AndroidX.Transition.dll *2
 38,993 assemblies/Xamarin.AndroidX.Browser.dll *2

Going to update various tests to latest Xamarin.Forms 5.0.0.2622.

Comment on lines -209 to +218
"Size": 3502580
"Size": 5908848
Copy link
Member Author

Choose a reason for hiding this comment

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

Xamarin.Forms 5 has a lot newer AndroidX libraries... Which is apparently a lot more Java code.

Comment on lines +550 to +552
"res/animator/linear_indeterminate_line2_tail_interpolator.xml": {
"Size": 400
},
Copy link
Member Author

Choose a reason for hiding this comment

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

Lots of new resources.

Comment on lines 187 to +197
"assemblies/Xamarin.AndroidX.RecyclerView.dll": {
"Size": 89997
"Size": 93990
},
"assemblies/Xamarin.AndroidX.SavedState.dll": {
"Size": 4909
"Size": 4969
},
"assemblies/Xamarin.AndroidX.SwipeRefreshLayout.dll": {
"Size": 10575
"Size": 13974
},
"assemblies/Xamarin.AndroidX.ViewPager.dll": {
"Size": 18594
"Size": 19073
Copy link
Member Author

Choose a reason for hiding this comment

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

Overall not seeing any Xamarin.AndroidX.*.dll files grow, which is good. 👍

Comment on lines 2281 to +2285
"resources.arsc": {
"Size": 325240
"Size": 777972
}
},
"PackageSize": 7941134
"PackageSize": 9593384
Copy link
Member Author

Choose a reason for hiding this comment

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

The app grew quite a bit going from Xamarin.Forms 4.7 -> Xamarin.Forms 5.

@jonathanpeppers jonathanpeppers marked this pull request as ready for review January 11, 2024 03:35
@jonathanpeppers jonathanpeppers merged commit a34988c into dotnet:main Jan 11, 2024
@jonathanpeppers jonathanpeppers deleted the TrimModeLink branch January 11, 2024 14:23
grendello added a commit that referenced this pull request Jan 11, 2024
* main:
  [Xamarin.Android.Build.Tasks] remove `%(TrimMode)=link` metadata (#8624)
@github-actions github-actions bot locked and limited conversation to collaborators Feb 11, 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.

2 participants