Skip to content

Prevent duplicate ML Kit barcode-scanning AAR packaging - #1520

Merged
jonathanpeppers merged 3 commits into
mainfrom
copilot/fix-barcode-scanning-duplicate-warnings
Aug 20, 2026
Merged

Prevent duplicate ML Kit barcode-scanning AAR packaging#1520
jonathanpeppers merged 3 commits into
mainfrom
copilot/fix-barcode-scanning-duplicate-warnings

Conversation

Copilot AI commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Fixes #1519.

Xamarin.Google.MLKit.BarcodeScanning must continue using Xamarin.Build.Download because the ML Kit AAR is distributed under license terms that prevent embedding it directly in the NuGet package.

The generated package currently exposes the same barcode-scanning AAR through three registrations:

  1. The local AAR is packed into lib/ by the binding project.
  2. Xamarin.Build.Download downloads the licensed AAR once at build time.
  3. The downloaded path is registered twice as XamarinBuildDownloadAndroidAarLibrary by the targets template.

The duplicate XBD items do not download the AAR twice; they add the same downloaded file to AndroidAarLibrary twice. Together with the embedded copy, this produces duplicate XA4301 native-library warnings for consumers.

This change:

  • Sets Pack="false" on the local XBD AndroidLibrary, keeping it available for binding generation without embedding it in the NuGet package.
  • Removes the duplicate XamarinBuildDownloadAndroidAarLibrary declaration while retaining one required declaration, so the licensed AAR is still downloaded and included exactly once for consumers.
  • Removes the obsolete pre-XBD-0.10 compatibility comment; the project pins Xamarin.Build.Download 0.11.4.
  • Bumps Xamarin.Google.MLKit.BarcodeScanning from 117.3.0.8 to 117.3.0.9.

The resulting package preserves the license-driven XBD flow and eliminates both sources of duplicate AAR inclusion.

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix duplicate XA4301 warnings in barcode scanning package Prevent duplicate ML Kit barcode-scanning AAR packaging Aug 14, 2026
Copilot AI requested a review from jonathanpeppers August 14, 2026 16:43
@jonathanpeppers
jonathanpeppers marked this pull request as ready for review August 14, 2026 19:05
Copilot AI lite review requested due to automatic review settings August 14, 2026 19:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request updates the Xamarin Build Download (XBD) packaging flow for Xamarin.Google.MLKit.BarcodeScanning to avoid embedding the same ML Kit barcode-scanning AAR that is also restored via build-transitive download targets, eliminating duplicated-native-library (XA4301) warnings for consumers.

Changes:

  • Prevent packing of local XBD AAR inputs by marking the AndroidLibrary item as Pack="false" in the XBD project template.
  • Remove a duplicate XamarinBuildDownloadAndroidAarLibrary item emission in the XBD targets template so the downloaded AAR is only included once.
  • Bump Xamarin.Google.MLKit.BarcodeScanning NuGet version from 117.3.0.8 to 117.3.0.9.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
source/XamarinBuildDownloadTargets.cshtml Adjusts generated build-transitive targets to avoid duplicating the downloaded AAR library item.
source/_XBDProjectType.cshtml Ensures local AAR inputs don’t get packed into the NuGet, avoiding embedding + download duplication.
config.json Version bump for Xamarin.Google.MLKit.BarcodeScanning to ship the packaging fix.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers

Copy link
Copy Markdown
Member

@dalexsoto review

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The local licensed AAR remains available for binding but is excluded from the package, the XBD-downloaded AAR is registered exactly once, and package 117.3.0.9 builds and validates without duplicate XA4301 warnings.

@jonathanpeppers
jonathanpeppers merged commit 44c3fe3 into main Aug 20, 2026
2 checks passed
@jonathanpeppers
jonathanpeppers deleted the copilot/fix-barcode-scanning-duplicate-warnings branch August 20, 2026 17:28
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.

Xamarin.Google.MLKit.BarcodeScanning packages barcode-scanning 17.3.0 twice (embedded AAR + XamarinBuildDownload), causing duplicate XA4301 warnings

4 participants