Skip to content

Add SDK license acceptance support (move from android-platform-support) #272

@rmarinho

Description

@rmarinho

Summary

Add SDK license acceptance support to Xamarin.Android.Tools.AndroidSdk for unattended/CI scenarios across all .NET Android tooling.

Background

The android-platform-support (internal) repository has AndroidLicensesStorage with battle-tested license acceptance that:

  • Orchestrates sdkmanager --licenses as a subprocess
  • Handles interactive Y/N prompts and sends acceptance answers
  • Writes license hashes to \/licenses/ directory
  • Supports both Google and VS license formats
  • Handles platform differences (sdkmanager.bat on Windows vs sdkmanager on macOS/Linux)
  • Validates that Android SDK, Java SDK, and cmdline-tools paths exist before proceeding

This capability should be moved to the public Xamarin.Android.Tools.AndroidSdk package.

Proposed API Surface

  • LicenseManager.AcceptAllAsync(sdkPath) — accept all pending SDK licenses via sdkmanager --licenses
  • LicenseManager.IsAccepted(sdkPath, licenseId) — check if a specific license is accepted
  • LicenseManager.GetPendingAsync(sdkPath) — list licenses that need acceptance

Consumer

  • MAUI DevTools CLI (maui android sdk accept-licenses, maui android install --accept-licenses) — see MAUI DevTools Spec PR
  • CI/CD pipelines — unattended builds that need to accept licenses without user interaction

Related

  • MAUI DevTools spec §6.8: Shared Libraries & Code Reuse

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions