'vs2019 - Xamarin: loses path settings of "Java Development Kit Location"

I do a very simple thing.

I go to Tools -> Options -> Xamarin> Android Settings and I change the "Java Development Kit Location" path. I press ok.

I compile the project and the option is used correctly.

I go to Tools -> Options -> Xamarin> Android Settings and the path is correct.

I restart VS, I go to Tools -> Options -> Xamarin> Android Settings and the path is wrong, it is the previous one.

Visual studio version used: Microsoft Visual Studio Community 2019 Version 16.11.7

happens to someone else?

is it a bug?

thanks



Solution 1:[1]

For the error with java development kit location, you could try the stpes below.

  1. Install the latest JDK 8 that's available from the Oracle Java SE Development Kit 8 Downloads webpage. https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
  2. Follow the instructions in the error message to manually point your Visual Studio instance to the location of your new JDK.

For the best mobile development experience, we encourage you to update to the latest Visual Studio version to keep up with the latest changes in iOS and Android development.

If you still want to use the old version and could not fix the error with the stpes above. You could try to repair the Visual Studio.

Solution 2:[2]

I faced a similar issue when updating visual studio 2019 from version 16.3 to 16.11 while working on a react native project, somehow my jdk installation got corrupted during or after installation. Initiating a repair it from the VS SDK manager did not work and I later found out that my jdk location was changed from:

C:\Program Files\Android\jdk\microsoft_dist_openjdk_1.8.0.25

to

C:\Program Files\Eclipse Foundation\jdk-8.0.302.8-hotspot

I updated the JAVA_HOME env variable to point to the new location then clean rebuild and everything is back to normal.

Hope this helps.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Wendy Zang - MSFT
Solution 2 Anass