Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug JAVA_HOME error when import Dependency Resolver

Discussion in 'LevelPlay' started by ycm-dev, Apr 2, 2023.

  1. ycm-dev

    ycm-dev

    Joined:
    Mar 9, 2022
    Posts:
    6
    When importing Ads Mediation (Or IronSource), it says that you must install the Mobile Dependency Resolver. After installing it, when I click "Dependency Resolver / Resolve" it gives a problem of "unity java_home environment references to directory", looking for JAVA it in a directory of an old unity installation (which is uninstalled) that no longer exists. I have updated the JAVA_HOME environment variable to the new ones, also in unity/preferences/external tools all the sdks,... and it still gives the same error-

    I use Unity 2022.2.12 and it looks for JAVA_HOME in the uninstalled 2021.3.15f1...

    Job failed with exception: GooglePlayServices.JavaUtilities+ToolNotFoundException: jar not found, C:\Program Files\Unity\Hub\Editor\2021.3.15f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK references incomplete Java distribution.
    at GooglePlayServices.PlayServicesResolver.ExtractZip (System.String zipFile, System.Collections.Generic.IEnumerable`1[T] extractFilenames, System.String outputDirectory, System.Boolean update) [0x00130] in <6107d0e161ea44f5b1a06a3cb63d4bc0>:0
    at Google.GradleWrapper.Extract (Google.Logger logger) [0x00045] in <6107d0e161ea44f5b1a06a3cb63d4bc0>:0
    at GooglePlayServices.GradleResolver.GradleResolution (System.String destinationDirectory, System.String androidSdkPath, System.Boolean logErrorOnMissingArtifacts, System.Boolean closeWindowOnCompletion, System.Action`1[T] resolutionComplete) [0x00085] in <6107d0e161ea44f5b1a06a3cb63d4bc0>:0
    at GooglePlayServices.GradleResolver.DoResolutionUnsafe (System.String destinationDirectory, System.Boolean closeWindowOnCompletion, System.Action resolutionComplete) [0x000ba] in <6107d0e161ea44f5b1a06a3cb63d4bc0>:0
    at GooglePlayServices.GradleResolver+<DoResolution>c__AnonStorey13.<>m__1D () [0x00000] in <6107d0e161ea44f5b1a06a3cb63d4bc0>:0
    at Google.RunOnMainThread.ExecuteNext () [0x0003d] in <bc484ae24804425b9f40a568d4bcd71d>:0
    UnityEngine.Debug:LogError (object)
    Google.RunOnMainThread:ExecuteNext ()
    Google.RunOnMainThread:<ExecuteAll>m__A ()
    Google.RunOnMainThread:RunAction (System.Action)
    Google.RunOnMainThread:ExecuteAll ()
    Google.RunOnMainThread:Run (System.Action,bool)
    GooglePlayServices.GradleResolver:DoResolution (string,bool,System.Action)
    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:ExecuteMenuResolve (bool)
    GooglePlayServices.PlayServicesResolver:MenuForceResolve ()
     

    Attached Files:

    Last edited: Apr 2, 2023
  2. yunanhou

    yunanhou

    Unity Technologies

    Joined:
    Feb 23, 2023
    Posts:
    35
  3. Rhein-Bytes

    Rhein-Bytes

    Joined:
    Jun 30, 2017
    Posts:
    3
  4. mbhagat

    mbhagat

    Joined:
    Dec 15, 2013
    Posts:
    49
    Facing same issue with iron source mediation adapter installed from following link.
    1. Download Unity Plugin Version 7.3.0.1
    The dependency resolver is trying to use 2019 unity version JAVA_HOME in unity 2021.3.23
    It is unity bug or iron source bug ?

    Even tried to make build from iron source demo project and same issue is coming.
     
  5. Rhein-Bytes

    Rhein-Bytes

    Joined:
    Jun 30, 2017
    Posts:
    3
    No help from IronSource or Unity.
    Now AdMob works without problems.
     
  6. Felicionato

    Felicionato

    Joined:
    Nov 9, 2015
    Posts:
    4
    I'm facing the same issue, JAVA_HOME pointing to a wrong path, Have tried everything, no luck, using Unity 2022.2.14 with Facebook SDK, Firebase and Ironsource LevelPlay, cannot resolve android dependencies because of this.
     
  7. rickygai

    rickygai

    Joined:
    Mar 9, 2022
    Posts:
    93
    I resolved the problem of JAVA_HOME, Mediation and "Gradle build failed". This problems are mostly related to existing old Unity configuration. I have Unity 2021.2.26f1, after migrated to 2022.3.0f1 then having Android compile problem. Later, found solutions below.

    1. Before you migrating to new Unity version, is very important to ensure current version ( eg. 2021.2.26f1 ) the Preferences > External Tools > Android settings are intact, no external JAVA path but only Unity supported path for Android JDK, SDK, NDK and Gradle. Do a backup of projects and do not uninstall existing Unity version ( eg. 2021.2.26f1 ) until all projects converted are working fine.

    2. Click “Copy Path” button, untick the "...Installed with Unity (recommended)" checkbox, click “Browse” button and paste the copied path info then tick the "...Installed with Unity (recommended)" checkbox again so both tick and untick path are the same. It is very important to stick to the Unity supported path otherwise JAVA_HOME, Mediation errors may occur.

    3. Remove depreciated line such as “android.enableR8=“ under gradleTemplate.properties file to avoid gradle compile error.

    4. Remove library components or packages that are not part of the project, I have no problem compile for Android with Mobile Dependency Resolver installed, but I removed it as not required in my project.

    5. Now, do an Android compile on current Unity version ( eg. 2021.2.26f1 ) to ensure error free.

    6. If statement 5 is clean and fine then you may open the project with new Unity version ( 2022.3.0f1 ), the new Unity Editor will prompt for upgrading and handle conversion automatically to land the project at right configuration.

    Hopes, this help.
     
    Last edited: Jun 5, 2023
  8. moosesnWoop

    moosesnWoop

    Joined:
    Sep 12, 2019
    Posts:
    9
    Same issue - actually scrapping ironsource until Unity gets that package as seamless as their own singluar intergration.

    I've got the latest JDK installed, with Unity doing that installation and pathing. Yet it says it's directing to a 2020.1.5f version of Unity instead of the 2022.5.8f version.

    Frustrating because it pops up every play instance and reload..
     
  9. madhur_novotrax

    madhur_novotrax

    Joined:
    Mar 28, 2023
    Posts:
    3
    I guess this error appears when you have any google sdk present in your project.
    Fix :
    1. In your unity Preferences (Edit -> Preferences) there is a JDK path, copy it.
    2. Open Environment variables in windows. Look under "System variables" for a variable name "JAVA_HOME" then Click Edit. (If not present Click Create).
    3. write variable name as "JAVA_HOME" and in variable value paste the JDK path you copied. and press OK.
    4. Restart unity.
    And it should work Fine!
     
  10. VOXELIUM

    VOXELIUM

    Joined:
    Nov 24, 2022
    Posts:
    37
    How can i do it on Mac M1 ?
     
    mviland likes this.
  11. liambilly

    liambilly

    Joined:
    May 13, 2022
    Posts:
    86
    still doesnt work for me,,,, anyone who found another solution
     
  12. a_strl

    a_strl

    Joined:
    Aug 12, 2019
    Posts:
    7
    Damn, that's weird my in my case

    Resolver error is:
    upload_2023-9-13_9-44-18.png

    but I am sure that my env setup is correct (already restarted the PC):
    upload_2023-9-13_9-46-35.png

    Any ideas how to fix that?
     
  13. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    612
    Can't believe this bug is still on the run... each time i update it comes back, and each time i need something different to fix it...

    EDIT: Seems to be a project specific problem this time...
     
    Last edited: Sep 18, 2023
    mviland likes this.