Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error MSB4044: The "AdjustJavacVersionArguments" task was not given a value for the required parameter "JdkVersion"

I'm trying to run an android application throw Visual Studio (7.4 Build 1033) and it seems that I'm having this problem :

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Error MSB4044: The "AdjustJavacVersionArguments" task was not given a value for the required parameter "JdkVersion". (MSB4044)

And... I don't know how to solve this issue...

I saw that Visual Studio has the correct path to JDK (mentionned "Found" in the UI) and also the version of JDK is 1.8.

Any hints for helping me ?

like image 941
Damiii Avatar asked Mar 23 '18 10:03

Damiii


3 Answers

Finally, I found the problem. Visual Studio was using the JDK from Android Studio... So I changed the path and begin to use the JDK that I installed with oracle (For instance (Mac) : ../Library/Java/...

like image 178
Damiii Avatar answered Oct 05 '22 06:10

Damiii


To check the issue:

  1. Go to Visual studio Preferences >> SDK Location >> Android
  2. Select the Locations tab

Here you will see the Location targeted for each, we are facing issue with JDK.

  1. Click on the folder selector so to navigate to the current location been pointed.
  2. In my case it was pointing to "usr/" folder
  3. Check the "libexec" folder inside "usr/" folder and look for "Java_Home"
  4. Execute the file "Java_Home", it will give you the location it is pointing toin the terminal window.

In my case it was pointing to "/Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home"

Now we know the location our VS is pointing to and we need to change this to required one. in my case "JDk 1.8"

  1. Click on the folder selector again and navigate to the folder "/Library/Java/JavaVirtualMachines"
  2. Here navigate to the desired JDK till "Contents/Home".

Make sure once you select and come back to VS the green tick is all set.

like image 45
VSB Avatar answered Oct 05 '22 07:10

VSB


The problem occurred on my machine after someone/something unexpectedly replaced JDK version 1.8 LTE with JDK 11 LTE. Seems that Xamarin is not compatible with any Java version except version 1.8.

Link to Microsoft Doc

Note that the version warning described in that article does not occur. Instead you run into the "AdjustJavacVersionArguments" error described above.

Having both versions installed in parallel seems to work fine, after I manually re-installed 1.8 and set the correct path to the JDK in Visual Studio (Tools-Options-Xamarin-Android Settings-Java Develoipment Kit Location") the error went away and I could successfully build and deploy my Xamarin projects again.

like image 44
Nimral Avatar answered Oct 05 '22 06:10

Nimral