可以在哪里设置 Android SDK 位置?Where can I set my Android SDK locations?

在 Visual Studio 中,导航到 "工具" > "> Xamarin > Android 设置" 选项以查看和设置 Android SDK 位置:In Visual Studio, navigate to Tools > Options > Xamarin > Android Settings to view and set the Android SDK location:

首选项中的示例位置选项卡Example Locations tab in Preferences

每个路径的默认位置如下所示:The default location for each path is as follows:

  • Java 开发工具包位置:Java Development Kit Location:

    C:\程序文件\Java\jdk 1.8.0 _131C:\Program Files\Java\jdk1.8.0_131

  • Android SDK 位置:Android SDK Location:

    C:\Program Files (x86)\Android\android-sdkC:\Program Files (x86)\Android\android-sdk

  • Android NDK 位置:Android NDK Location:

    C:\ProgramData\Microsoft\AndroidNDK64\android-r13bC:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b

请注意,NDK 的版本号可能会有所不同。Note that the version number of the NDK may vary. 例如,它可以是较早的版本,如android-r10e,而不是r13bFor example, instead of android-ndk-r13b, it could be an earlier version such as android-ndk-r10e.

若要设置 Android SDK 位置,请在 " Android SDK 位置" 框中输入 Android SDK 目录的完整路径。To set the Android SDK location, enter the full path of the Android SDK directory into the Android SDK Location box. 您可以在文件资源管理器中导航到 Android SDK 位置,从地址栏复制路径,然后将此路径粘贴到Android SDK 位置框中。You can navigate to the Android SDK location in File Explorer, copy the path from the address bar, and paste this path into the Android SDK Location box. 例如,如果你的 Android SDK 位置是C:\用户\用户名\AppData\本地\Android\SDK,请清除 " Android SDK 位置" 框中的旧路径,粘贴到此路径中,然后单击 "确定"For example, if your Android SDK location is at C:\Users\username\AppData\Local\Android\Sdk, clear the old path in the Android SDK Location box, paste in this path, and click OK.