can i get the links just like this guy for my unity version 2022.3.35f1
Hello, I wanted to add Unity Ads (Advertisement Legacy) to my project. It still builds fine and everything, but like every 5 mins I get error that I need to install OpenJDK. It is really annoying. This did not happen before I installed Advertising package. Also, sometimes android resolver pops up but does nothing. I also had issues before with something called android gradle (I was not able to do notifications). I tried deleting and reinstalling JDK and SDK and so from unity hub, but it deos not detect that I deleted them (I have restored them from bin now). That oracle site is also outdated.
Edit: I have a button in my scene that should load an ad in build, but nothing happens (Rest of app is fine)
Check what’s your JAVA_HOME
, and see if it’s the same as the one that Unity is using.
- Open Command-line prompt
- Run:
echo %JAVA_HOME%
bruh…
I think that means that Java home is not defined? Think that could be the issue?
btw, this is the warning I keep getting:
My recommendation would be to first try to update Unity to the latest LTS version available. Currently it’s 2022.3.44f1
(download link), that might solve the issue.
How to Set the JAVA_HOME
Environment Variable in Windows
-
Open System Properties:
- Press
Win + X
and select “System”. - In the “System” window, click on “Advanced system settings” on the left side.
- In the “System Properties” window, click on the “Environment Variables” button.
- Press
-
Set
JAVA_HOME
Variable:- In the “Environment Variables” window, under the “System variables” section, click “New…”.
- For the “Variable name”, enter:
JAVA_HOME
- For the “Variable value”, enter your
OpenJDK
path from theExternal Tools
Unity window:C:\Program Files\Unity\Hub\Editor\2022.3.17f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK
- Click “OK” to save the new variable.
-
Update the Path Variable (Optional but Recommended):
- In the same “Environment Variables” window, find the “Path” variable under “System variables”, select it, and click “Edit…”.
- Click “New” and add the following path:
%JAVA_HOME%\bin
- Click “OK” to save and close all windows.
-
Verify the Setup:
- Open a new Command Prompt and type:
echo %JAVA_HOME%
- This should return the path you set.
- To verify that
java
is recognized, type:java -version
- It should display the version of Java located in the specified directory.
- Open a new Command Prompt and type:
This setup ensures that JAVA_HOME
is permanently set and available to all programs that require it.
Thanks for the response! I will reply again when I have done those steps.
OK, I have tried setting JAVA_HOME variable, now I get a different error/warning:
Failed to get Java version when running C:\Program Files\Common Files\Oracle\Java\javapath\java.exe
It is not be possible to verify your Java installation is new enough to compile with the latest Android SDK
Failed to run 'C:\Program Files\Common Files\Oracle\Java\javapath\java.exe -version'
stdout:
stderr:
exit code: -1073740791
UnityEngine.Debug:LogWarning (object)
Google.Logger:Log (string,Google.LogLevel)
GooglePlayServices.PlayServicesResolver:Log (string,Google.LogLevel)
GooglePlayServices.JavaUtilities:LogJdkVersionFailedWarning (string,string)
GooglePlayServices.JavaUtilities:CheckJdkForApiLevel ()
GooglePlayServices.PlayServicesResolver:ResolveUnsafe (System.Action`1<bool>,bool,bool,bool)
GooglePlayServices.PlayServicesResolver/<ScheduleResolve>c__AnonStorey1E:<>m__3F ()
GooglePlayServices.PlayServicesResolver:ExecuteNextResolveJob ()
GooglePlayServices.PlayServicesResolver:ScheduleResolve (bool,bool,System.Action`1<bool>,bool)
GooglePlayServices.PlayServicesResolver:AutoResolve (System.Action)
GooglePlayServices.PlayServicesResolver:<ScheduleAutoResolve>m__47 ()
Google.RunOnMainThread:ExecutePollingJobs ()
Google.RunOnMainThread:<ExecuteAll>m__A ()
Google.RunOnMainThread:RunAction (System.Action)
Google.RunOnMainThread:ExecuteAll ()
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()
I think that’s the same issue I have: When I run java -version in cmd, I get no response
I have now installed new Unity Editor. How do I upgrade to the new version? Do I need to copy all files over to a new project in new editor? Do I need to delete old editor?
Just open the same project with the new Editor. A popup dialgo should appear asking for permission to automatically upgrade the project.
done that. Still nooootthhing I can press buttons and nooothing happens
I don’t know what to do anymore…