简体   繁体   English

Visual Studio Xamarin 上 Windows 10:无法确定 Java 版本

[英]Visual Studio Xamarin on Windows 10: Cannot determine Java Version

I've been trying to get started with Xamarin on Visual Studio Community 2019, but every time a new Android project is created and run, deployment is aborted and the warning below appears.我一直在尝试在 Visual Studio Community 2019 上开始使用 Xamarin,但每次创建并运行新的 Android 项目时,部署都会中止并出现以下警告。 I've already uninstalled and reinstalled both Java and VS, modified and repaired VS, and tried out different versions of the JDK, yielding no results.我已经卸载并重新安装了Java和VS,修改并修复了VS,并尝试了不同版本的JDK,没有结果。 Any ideas on why this may be happening and how can it be fixed?关于为什么会发生这种情况以及如何解决的任何想法?

The current version of the JDK I'm using is 17.0.1我正在使用的 JDK 的当前版本是 17.0.1 Visual Studio 中显示的错误消息

You can recheck if you have set up the Android SDK for Xamarin.Android correctly.您可以重新检查您是否已正确设置 Android SDK 为 Xamarin.ZE84E30B9390CDB64ZDDB6DB2C9

Xamarin.Android uses the Java Development Kit (JDK) and the Android SDK to build apps. Xamarin.Android uses the Java Development Kit (JDK) and the Android SDK to build apps. During installation, the Visual Studio installer places these tools in their default locations and configures the development environment with the appropriate path configuration.在安装过程中,Visual Studio 安装程序将这些工具放置在它们的默认位置,并使用适当的路径配置来配置开发环境。

And for most users these default locations will work without further changes.对于大多数用户而言,这些默认位置无需进一步更改即可使用。

Xamarin.Android uses JDK 11 , which is required for API 31 and greater, JDK 8 , which is required if you are developing for API level 24 to 30 (JDK 8 also supports API levels earlier than 24). Xamarin.Android uses JDK 11 , which is required for API 31 and greater, JDK 8 , which is required if you are developing for API level 24 to 30 (JDK 8 also supports API levels earlier than 24).

For example:例如:

在此处输入图像描述

For most users these default locations will work without further changes.对于大多数用户而言,这些默认位置无需进一步更改即可使用。

For more, you can check: https://docs.microsoft.com/en-us/xamarin/android/get-started/installation/windows#configuration有关更多信息,您可以查看: https://docs.microsoft.com/en-us/xamarin/android/get-started/installation/windows#configuration

For how to set up the Android SDK for Xamarin.Android, you can check: Setting up the Android SDK for Xamarin.Android . For how to set up the Android SDK for Xamarin.Android, you can check: Setting up the Android SDK for Xamarin.Android .

Note:笔记:

I recommend that you remove the older sdk and jdk files and use the latest version of Visual Studio with the default JDK and SDK Settings.我建议您删除较旧的 sdk 和 jdk 文件,并使用具有默认 JDK 和 SDK 设置的最新版本的 Visual Studio。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM