Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure DevOps Pipeline Android SDK not found

It's stop and say: Android SDK not found.

My app is in Maui and dotnet 8.

Here is the plan:

      - task: NuGetCommand@2
        displayName: 'NuGet restore'
        inputs:
          restoreSolution: '--/--.sln'
          noCache: true
      - task: CmdLine@2
        displayName: workload install maui
        inputs:
          script: |
            dotnet workload install maui-android --source https://aka.ms/dotnet8/nuget/index.json --source https://api.nuget.org/v3/index.json
      - task: DotNetCoreCLI@2
        displayName: dotnet build
        inputs:
          projects: ---/---.csproj
          arguments: -c Release -f net8.0-android

it says: Error XA5300: The Android SDK directory could not be found. Install the Android SDK

Working pipeline that generate the aab

like image 210
Mafyou Avatar asked Sep 01 '26 06:09

Mafyou


1 Answers

For me I was attempting to build a MAUI Android app on Azure pipeline Ubuntu hosted vm with error below.

error XA5300: The Android SDK directory could not be found. Install the Android SDK by following the instructions at: https://aka.ms/dotnet-android-install-sdk

error XA5300: To use a custom SDK path for a command line build, set the 'AndroidSdkDirectory' MSBuild property to the custom path.

Adding --verbosity detailed to dotnet publish showed the correct path to Android SDK.

ValidateAndroidSdkLocation: for locator=constructor param, path=/usr/local/lib/android/sdk, result=False  
ValidateAndroidSdkLocation: for locator=preferred path, path=``, result=False  
ValidateAndroidSdkLocation: for locator=all paths, path=/usr/local/lib/android/sdk, result=False  
ValidateAndroidSdkLocation: for locator=all paths, path=/usr/local/lib/android/sdk, result=False  
ValidateAndroidSdkLocation: for locator=all paths, path=/home/vsts/Library/Android/sdk, result=False  

In the end it was specifically the platform-tools that was not installed on the default ubuntu-22.04 build VM. Adding the line below made the dotnet maui build happy.

$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager "platform-tools"
like image 76
Nathan Smith Avatar answered Sep 03 '26 20:09

Nathan Smith