Skip to content

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

Open

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

Activity

  1. added
    enhancement
    on Feb 19, 2026
  2. rmarinho commented on Feb 23, 2026

    @rmarinho
    MemberAuthor

    Implementation Progress

    I've implemented partial support for this issue as part of MAUI DevTools work:

    ✅ Implemented: Basic license acceptance

    csharp // In SdkManagerRunner class public async Task<ToolRunnerResult> AcceptLicensesAsync(CancellationToken cancellationToken = default) { // Runs: sdkmanager --licenses // Sends ""y"" to stdin to accept all licenses }

    This handles the common ""accept all licenses"" use case for CI/CD.

    ❌ NOT Implemented

    The full API surface from this issue is not yet implemented:

    • LicenseManager.IsAccepted(sdkPath, licenseId) — check specific license status
    • LicenseManager.GetPendingAsync(sdkPath) — list licenses needing acceptance

    What's needed to complete this issue

    1. Parse <SDK>/licenses/ directory to check accepted license hashes
    2. Compare against known license IDs to determine pending status
    3. Potentially parse sdkmanager --licenses output to get license text/IDs

    Code location

    Current implementation in SdkManagerRunner.AcceptLicensesAsync():

    • src/Xamarin.Android.Tools.AndroidSdk/Runners/SdkManagerRunner.cs
  3. added
    android-tools
    on Jul 13, 2026
  4. added
    needs-triage
    on Jul 13, 2026
  5. removed
    needs-triage
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    android-toolsenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions