#Android Resolver looks for wrong OpenJDK folder

1 messages · Page 1 of 1 (latest)

whole crater
#

I'm trying to build my app, but I keep getting the same error:
JAVA_HOME environment references a directory (C:/Program Files/Unity/Hub/Editor/2021.3.24f1/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK) that does not contain jar which is required to process Android libraries.
The folder 'C:/Program Files/Unity/Hub/Editor/2021.3.24f1/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK' does not exist, as I don't have that version downloaded. I am on 6000.1.13f1. In the preferences I have the JDK, SDK, NDK and gradle all pointed to the 6000 folder. The environment variables used to point to 2021.3.23f1 (which I also didn't have anymore), but after changing them to 6000 nothing changed. I tried android resolve, force android resolve, and reinstall the whole editor in the unity hub along with reinstalling the android packages. Nothing seems to fix this error. Opening the unity folder in vscode and searching specifically for '2021.3.24f1' doesn't give me any results either.
I am completely lost in this. I can't build anything or patch them to my phone. Everytime I try, Unity crashes.

Would anyone know how to fix this?

safe flame
#

you may have edited your JAVA_HOME env var and now it points to something that no longer exists

#

you can install the jdk and it should correct this for you

tender mango
#

do you have the various checkboxes for Preferences/External Tools/Android checked? Try unchecking them (but leaving the default embedded path). I've found Unity sometimes forgets to update the path in editor prefs, and if the that editor is no longer installed then obviously the jdk etc is just gone. It's happened so frequently that I automated specifying the default paths in my CI env build script.

You can find out what Unity thinks it's using by looking at these EditorPrefs (ex: EditorPrefs.GetString):
AndroidSdkRoot, AndroidNdkRoot, AndroidNdkRootR19
and which JAVA_HOME is set with
Enviornment.GetEnvironmentVariable("JAVA_HOME")