"JAVA_HOME is set to an invalid directory" error in Xamarin Android UITest

Pelin Konaray 291 Reputation points
2021-12-13T08:44:56.327+00:00

Hi,

I have Xamarin.UITests for ios and android. And I run its in two devices as async with command line on the androids.
(with this command: dotnet "C:\Users\PCName\Desktop\AppName\RunMobileTest\bin\Debug\netcoreapp2.2\RunMobileTest.dll")

I run it about a month ago with no problem. But when I run now, it returns this error:
156947-image.png

I searched this, but I couldn't any information.
Additionally I looked to the "C:\Program Files\Android\jdk" location, but there is no folder and file named "microsoft_dist_openjdk_1.8.0.25". I can find only a folder named "jdk-8.0.302.8-hotspot"
157067-image.png

I try to change JAVA_HOME path as "C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot" and "C:\Program Files\Java\jdk1.8.0_201" from environment variables. But none of them didn't work.

What can I do?
Thanks in advance.

Developer technologies .NET Xamarin
0 comments No comments
{count} votes

Accepted answer
  1. Pelin Konaray 291 Reputation points
    2021-12-13T10:51:37.053+00:00

    I found a solution. I tried to change JAVA_HOME path as "C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot" from environment variables (user variables) as I said above. But I didn't change system variables. I also added "C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\bin" to system variables as "Path". It worked.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.