Skip to content

Fail InstallAndroidDependencies cleanly when ResolveAndroidTooling has no resolved SDK#11321

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-install-android-dependencies
Draft

Fail InstallAndroidDependencies cleanly when ResolveAndroidTooling has no resolved SDK#11321
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-install-android-dependencies

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 11, 2026

InstallAndroidDependencies could exit successfully even when a required platform package was still missing. On a fresh SDK/JDK path, ResolveAndroidTooling could dereference an unresolved SDK state, emit XARAT7001, and leave dependency installation to continue as warnings instead of producing a hard failure.

  • What changed

    • ResolveAndroidTooling now checks that SDK resolution actually produced a usable MonoAndroidHelper.AndroidSdk and AndroidSdkPath before probing build-tools / cmdline-tools paths.
    • When that state is missing, the task logs the normal XA5300 Android SDK error and returns false instead of throwing XARAT7001 from a NullReferenceException.
  • Why this matters

    • InstallAndroidDependencies now gets a real task failure signal when SDK tooling resolution has not succeeded.
    • This prevents the previous "warning chain + exit 0" behavior that allowed missing required packages such as platforms;android-37.0 to surface only later as XA5207.
  • Focused coverage

    • Added a task-level regression test for the missing-resolved-SDK state.
    • The test asserts that ResolveAndroidTooling:
      • fails deterministically,
      • still computes AndroidApiLevel for dependency resolution,
      • reports XA5300,
      • does not report XARAT7001.
var androidSdk = MonoAndroidHelper.AndroidSdk;
if (androidSdk == null || AndroidSdkPath.IsNullOrEmpty ()) {
	Log.LogCodedError ("XA5300", Properties.Resources.XA5300_Android_SDK);
	return false;
}

Agent-Logs-Url: https://github.com/dotnet/android/sessions/ab9b627b-2492-407c-b80c-661d58857a34

Co-authored-by: davidnguyen-tech <87228593+davidnguyen-tech@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix silent failure in InstallAndroidDependencies for android-37.0 Fail InstallAndroidDependencies cleanly when ResolveAndroidTooling has no resolved SDK May 11, 2026
Copilot AI requested a review from davidnguyen-tech May 11, 2026 15:26
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.

[InstallAndroidDependencies] silently fails to install platforms;android-37.0 on fresh SDK dir (XARAT7001 NRE), exits 0

2 participants