Skip to content

Remove build-time Java resources from APKs - #12792

Open
simonrozsival wants to merge 2 commits into
mainfrom
simonrozsival-remove-apk-dead-weight
Open

simonrozsival wants to merge 2 commits into
mainfrom
simonrozsival-remove-apk-dead-weight

Conversation

@simonrozsival

@simonrozsival simonrozsival commented Sep 15, 2026

Copy link
Copy Markdown
Member

Java archives can contribute build-time-only resources to APK and AAB outputs, including nested classes.jar files, Kotlin Multiplatform metadata, and embedded shrinker configuration.

This change:

  • adds anchored default AndroidPackagingOptionsExclude items in AutoImport.in.props
  • removes nested JARs, KMP metadata, R.txt, ProGuard/R8 rules, and AAR metadata
  • preserves runtime resources such as META-INF/services and Kotlin builtins
  • extends the existing packaging test to cover both APK and AAB paths
  • updates the affected CoreCLR XForms APK size references

Tests:

  • ./dotnet-local.sh test bin/TestRelease/net10.0/Xamarin.Android.Build.Tests.dll --filter "Name~CheckExcludedFilesAreMissing"
  • PATH="$PWD/bin/Release/tools:$PATH" ./dotnet-local.sh test bin/TestRelease/net10.0/Xamarin.Android.Build.Tests.dll --filter "Name~BuildReleaseArm64"

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 15, 2026 11:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

AAB archive paths and include overrides need focused test coverage.

Get a fresh assessment by requesting another Copilot review.

Review tier: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

This PR removes build-time-only Java archive entries from APK/AAB packages while preserving runtime resources and explicit inclusion overrides.

Changes:

  • Filters nested JARs, KMP metadata, resource symbols, shrinker rules, and AAR metadata.
  • Adds focused tests and documentation.
  • Updates CoreCLR APK size baselines.
File Summary
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.ProjectTools/​Resources/​Base/​BuildReleaseArm64XFormsDotNet.CoreCLR.R8.apkdesc Updates APK size baseline.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.ProjectTools/​Resources/​Base/​BuildReleaseArm64XFormsDotNet.CoreCLR.apkdesc Updates APK size baseline.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.ProjectTools/​Resources/​Base/​BuildReleaseArm64SimpleDotNet.CoreCLR.R8.apkdesc Updates APK size baseline.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.ProjectTools/​Resources/​Base/​BuildReleaseArm64SimpleDotNet.CoreCLR.apkdesc Updates APK size baseline.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​Tasks/​CollectJarContentFilesForArchiveTests.cs Tests filtering and explicit inclusion.
src/​Xamarin.Android.Build.Tasks/​Tasks/​CollectJarContentFilesForArchive.cs Implements build-time resource filtering.
Documentation/​docs-mobile/​building-apps/​build-items.md Documents packaging behavior.

Comment thread src/Xamarin.Android.Build.Tasks/Tasks/CollectJarContentFilesForArchive.cs Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants