JadedEric
JadedEric

Reputation: 2073

TFS on-premise Xamarin cannot find AndroidSDK

I have a build definition set up in our on-prem TFS 2018 instance and it's just not working for us.

We have Visual Studio 2017 Enterprise installed on the TFS server instance, including Xamarin Studio, pointing to the default /program files (86)/android/android-sdk location, and we've created two (2) environment variables on the Server, called AndroidSDK and Xamarin.Android, yet we're still getting a build failure:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets (617, 2)
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(617,2): Error XA5205: The Android SDK Directory could not be found. Please set via /p:AndroidSdkDirectory.
Process 'msbuild.exe' exited with code '1'.

We've tried setting /p:{} as an Additional parameter in the Android build step, but this also fails unexpectedly.

Are we missing something here? Any help would really be appreciated.

Note we're trying out on-premise for our team

Upvotes: 1

Views: 648

Answers (1)

Andy Li-MSFT
Andy Li-MSFT

Reputation: 30362

This issue is most likely due to one or both of the following reasons:

  1. Android SDK Tools are removed accidentally (or Antivirus has removed these tools)
  2. Android SDK Platform-tools are removed accidentally (or Antivirus has removed these tools)

In case of this issue, SDK manager will not work. And the options to run SDK Manager within Visual Studio will also be disabled. On the Android SDK installation path one or both of the following folders will be missing:

  • tools
  • platform-tools

So, you just need to reinstall the Tools. Please refer to Wasim's blog for details.


Besides, in TFS the build agent on the server runs in its own account (build service account), so the Android SDK must be accessible to it. which meant that a local build on the server may worked fine, but the TFS build agent couldn't access it and thus failed. In this case, you can move the SDK to an accessible place for the build agent service account, thus everything will be worked.

Refer to this link for details : Resolving “The Android SDK Directory could not be found” building a Xamarin app via TFS build server

Upvotes: 1

Related Questions