Search Unity

Trouble installing GPG plugin, bad JAVA_HOME path [SOLVED]

Discussion in 'Android' started by Livealot, Mar 15, 2019 at 5:53 AM.

  1. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    77
    In the install instruction for the Google Play Game plugin for Unity, there's a section about correctly setting the JAVA_HOME and PATH variables.

    I believe I followed the correctly for my system, but on importing the plugin I get an error about a bad path that's pointing to a completely different place. It looks like there's something hardcoded in the plugin (pointing to CleoSchneider's system) that I haven't figured out how to reset.

    This happens when installing into an existing project and into a completely new project.

    Anyone else having trouble installing the plugin with Unity 2018.3.3f1? Anyone find a workaround?

    Full error:
    Code (CSharp):
    1. Job failed with exception: GooglePlayServices.JavaUtilities+ToolNotFoundException: jar not found, C:\Program Files\Unity\Hub\Editor\2018.3.0b3\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\OpenJDK\Windows references incomplete Java distribution.
    2.   at GooglePlayServices.PlayServicesResolver.ExtractZip (System.String zipFile, System.String[] extractFilenames, System.String outputDirectory) [0x000a9] in /usr/local/google/home/cleoschneider/google-play-resolver/unity-jar-resolver/source/PlayServicesResolver/src/PlayServicesResolver.cs:1634
    3.   at GooglePlayServices.ResolverVer1_1.GradleResolution (System.String destinationDirectory, System.String androidSdkPath, System.Boolean logErrorOnMissingArtifacts, System.Action`1[T] resolutionComplete) [0x000ff] in /usr/local/google/home/cleoschneider/google-play-resolver/unity-jar-resolver/source/PlayServicesResolver/src/ResolverVer1_1.cs:547
    4.   at GooglePlayServices.ResolverVer1_1.DoResolutionUnsafe (Google.JarResolver.PlayServicesSupport svcSupport, System.String destinationDirectory, System.Action resolutionComplete) [0x000a1] in /usr/local/google/home/cleoschneider/google-play-resolver/unity-jar-resolver/source/PlayServicesResolver/src/ResolverVer1_1.cs:1066
    5.   at GooglePlayServices.ResolverVer1_1+<DoResolution>c__AnonStorey1C.<>m__34 () [0x0000d] in /usr/local/google/home/cleoschneider/google-play-resolver/unity-jar-resolver/source/PlayServicesResolver/src/ResolverVer1_1.cs:948
    6.   at GooglePlayServices.ResolverVer1_1.UpdateTryResolution () [0x0003a] in /usr/local/google/home/cleoschneider/google-play-resolver/unity-jar-resolver/source/PlayServicesResolver/src/ResolverVer1_1.cs:963
    7.   at Google.RunOnMainThread.ExecuteNext () [0x0003d] in /usr/local/google/home/cleoschneider/google-play-resolver/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:363
    8. UnityEngine.Debug:LogError(Object)
    9. Google.RunOnMainThread:ExecuteNext() (at /usr/local/google/home/cleoschneider/google-play-resolver/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:365)
    10. Google.RunOnMainThread:<ExecuteAll>m__16() (at /usr/local/google/home/cleoschneider/google-play-resolver/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:394)
    11. Google.RunOnMainThread:RunAction(Action) (at /usr/local/google/home/cleoschneider/google-play-resolver/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:234)
    12. Google.RunOnMainThread:ExecuteAll() (at /usr/local/google/home/cleoschneider/google-play-resolver/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:392)
    13. Google.RunOnMainThread:Run(Action, Boolean) (at /usr/local/google/home/cleoschneider/google-play-resolver/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:349)
    14. GooglePlayServices.ResolverVer1_1:DoResolution(PlayServicesSupport, String, Action) (at /usr/local/google/home/cleoschneider/google-play-resolver/unity-jar-resolver/source/PlayServicesResolver/src/ResolverVer1_1.cs:953)
    15. GooglePlayServices.PlayServicesResolver:ResolveUnsafe(Action`1, Boolean, Boolean) (at /usr/local/google/home/cleoschneider/google-play-resolver/unity-jar-resolver/source/PlayServicesResolver/src/PlayServicesResolver.cs:1429)
    16. GooglePlayServices.<ScheduleResolve>c__AnonStorey12:<>m__22() (at /usr/local/google/home/cleoschneider/google-play-resolver/unity-jar-resolver/source/PlayServicesResolver/src/PlayServicesResolver.cs:1305)
    17. GooglePlayServices.PlayServicesResolver:ExecuteNextResolveJob() (at /usr/local/google/home/cleoschneider/google-play-resolver/unity-jar-resolver/source/PlayServicesResolver/src/PlayServicesResolver.cs:1224)
    18. GooglePlayServices.PlayServicesResolver:ScheduleResolve(Boolean, Action`1, Boolean) (at /usr/local/google/home/cleoschneider/google-play-resolver/unity-jar-resolver/source/PlayServicesResolver/src/PlayServicesResolver.cs:1316)
    19. GooglePlayServices.PlayServicesResolver:ExecuteMenuResolve(Boolean) (at /usr/local/google/home/cleoschneider/google-play-resolver/unity-jar-resolver/source/PlayServicesResolver/src/PlayServicesResolver.cs:1481)
    20. GooglePlayServices.PlayServicesResolver:MenuResolve() (at /usr/local/google/home/cleoschneider/google-play-resolver/unity-jar-resolver/source/PlayServicesResolver/src/PlayServicesResolver.cs:1496)
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    2,012
    Sounds like you need to install JDK8 and change JDK in Unity Preferences.
    We ship Unity with OpenJDK8.
    Note that you cannot use JDK9 or later, Android tools are not compatible with it.
     
  3. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    77
    Thanks for the reply Aurimas. I agree the error is looking for the missing jar, but it seems like the problem is that it's not where the PlayResolver dll thinks it should be, which seems to be hard-coded, rather than where it is on my machine.

    Or maybe I'm confused by needing to install something that already comes with Unity??? I installed Unity 2018.3, which includes OpenJDK8, I have "Use embedded JDK" checked and my environmental variables point to that installation.

    Is there a different step to "install JDK8" or do I need to install the NDK for some reason?? Here is my Preferences setup
    ndkblank.JPG
     
  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    2,012
    It might be that OpenJDK lacks some jar file that is included in Oracle JDK. Try downloading JDK8 from Oracle and point Unity to it.
    Your problem has nothing to do with NDK.
     
  5. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    77
    Aha! I unchecked the "Use Embedded JDK" box in the Preferences and this exposed the bad reference

    So the GPG plugin PlayServicesResolver uses a setting in Preferences that is hidden by default

    To fix:
    1. Deselect "Use Embedded JDK"
    2. Provide the correct location for your editor's OpenJDK location, probably something like...
    D:\Program Files\Unity Editors\2018.3.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\OpenJDK\Windows
    1. Then reselect "Use Embedded JDK"
    2. reboot Unity
     
    Last edited: Mar 15, 2019 at 4:41 PM