Android build pipeline in Azure DevOps: "Unable to locate Android SDK"

Hello, community!

I am writing to seek help on a problem. We are trying to automate the compilation and deployment of a Unity project for Android.

We have a custom build agent, managed with Microsoft’s Azure DevOps. A Windows machine with the following:

Unity 3D

  • Unity Hub
  • Unity 2018 LTS + Visual Studio 2017 (or higher)
  • Android build support

Android Studio

  • SDK Platform 28 (Android 9.0)
  • SDK Tools
  • Android NDK r16b

Android JDK

  • Android JDK 11

The manual generation of an APK in this compilation agent has no complications, it runs smoothly.

The problem comes when running through the pipeline in Azure DevOps, the error message we get is the following:

DisplayProgressbar: Detecting Android SDK
UnityException: Android SDK not found
Unable to locate Android SDK.

We are using Unity Tools for Azure DevOps, to manage the build.

I don’t know if anyone else has run into this issue but we don’t understand why a manual build runs fine and Unity is not able to find the Android SDK via Azure DevOps pipeline.

Any recommendation or help?

Could you find the solution to this problem?