android - TFS 本地 Xamarin 找不到 AndroidSDK

标签 android xamarin.forms tfsbuild

我在本地 TFS 2018 实例中设置了构建定义,但它对我们不起作用。

我们在 TFS 服务器实例上安装了 Visual Studio 2017 Enterprise,包括 Xamarin Studio,指向默认的/program files (86)/android/android-sdk 位置,我们已经创建了两 (2) 个环境变量服务器,称为 AndroidSDK 和 Xamarin.Android,但我们仍然遇到构建失败:

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'.

我们已尝试将/p:{} 设置为 Android 构建步骤中的附加参数,但这也意外失败。

我们是否遗漏了什么?非常感谢任何帮助。

注意我们正在为我们的团队试用本地

最佳答案

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

因此,您只需重新安装工具即可。请引用Wasim's blog了解详情。


此外,在 TFS 中,服务器上的构建代理在其自己的帐户(构建服务帐户)中运行,因此它必须可以访问 Android SDK。这意味着服务器上的本地构建可能工作正常,但 TFS 构建代理无法访问它并因此失败。在这种情况下,您可以将 SDK 移动到构建代理服务帐户可访问的位置,这样一切都会正常进行。

有关详细信息,请参阅此链接: Resolving “The Android SDK Directory could not be found” building a Xamarin app via TFS build server

关于android - TFS 本地 Xamarin 找不到 AndroidSDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48523631/

相关文章:

c# - Xamarin 在页面之间传递参数

java - setOnClickListener(this) 的性能注意事项

java - 以编程方式添加时 GridLayout 溢出屏幕

java - LinearLayout - 在 TextView 之后添加 TableLayout

tfs - 如何在 TFS Build 2010 中执行简单的 Exec 事件

node.js - 如何在 Visual Studio Online 中将 Node.js 应用程序部署到 Azure?

.net-3.5 - TFS 构建服务器 - CSC : fatal error CS2008: No inputs specified

android - 回收 ui 元素

c# - 无法建立 SSL 连接

xamarin.forms - 标签页 OnAppearing()