Search Unity

Question How to ensure Google Play Games Pre-requisites are installed?

Discussion in 'Android' started by N1ghtrunner, Feb 5, 2023.

  1. N1ghtrunner

    N1ghtrunner

    Joined:
    Jan 5, 2015
    Posts:
    104
    When preparing to install the Play Game Services Plugin, the Android setup section states the following:
    I have set my unity installation up so that it has installed the Android SDK and OpenJDK as part of the installation. So the question is how does one ensure the above are in place before attempting the integration? I have searched for the Android SDK Manager but this does not appear to be part of the Unity Android SDK setup, or at least it is not obvious as to where this is.

    I have a seperate installation of Android Stuido which is using another SDK location, which I cannot ammend to be the Unity location (and maybe this isn't a good idea anyway). Any assistance appreciated.
     
  2. N1ghtrunner

    N1ghtrunner

    Joined:
    Jan 5, 2015
    Posts:
    104
    As a follow-up to this, from another thread I have used the SDKManager command-line tool that IS included with the Unity Android SDK installation and it has revealed to me that the installed packages are as follows:

    D:\Unity\Hub\Editor\2021.3.12f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\bin>sdkmanager --list
    Warning: File C:\Users\myname\.android\repositories.cfg could not be loaded.
    Installed packages:=====================] 100% Computing updates...
    Path | Version | Description | Location
    ------- | ------- | ------- | -------
    build-tools;30.0.2 | 30.0.2 | Android SDK Build-Tools 30.0.2 | build-tools\30.0.2\
    platform-tools | 30.0.4 | Android SDK Platform-Tools 30.0.4 | platform-tools\
    platforms;android-29 | 5 | Android SDK Platform 29, rev 5 | platforms\android-29\
    platforms;android-30 | 3 | Android SDK Platform 30, rev 3 | platforms\android-30\
    platforms;android-31 | 1 | Android SDK Platform 31 | platforms\android-31\
    tools | 26.1.1 | Android SDK Tools 26.1.1 | tools\

    So as we can see none of the packages that the Play Games Git says need to be installed are installed. Is this correct? Does this cause issues from a Unity perspective? I am, given allllll the trouble I have had in trying to get this to work, wanting to install the noted packages.

    It does seem to me that there are some serious drawbacks to allowing Unity to install the Android SDK and OpenJDK if you want to make use of 3rd party integrations like...ahem....Google services.
     
  3. N1ghtrunner

    N1ghtrunner

    Joined:
    Jan 5, 2015
    Posts:
    104
    I have now attempted to install the above packages which seems to have worked however I am still seeing the same errors as have been plaguing me from my initial attempts to get this integration working:

    1. I cant get anything re: GPGS to work if I build directly to my phone
    2. When I download from an Internal Test Track on the Google Developer console, my username flashes on app opening making it appear that I have authenticated (default action of the 11.01 plugin?), however I see the below errors in the logs, which I can repeat at will when I try to display a leaderboard UI, or login manually using SocialPlatforms. Something is wrong/missing:

    2023/02/04 12:37:57.334 20655 20677 Error Unity AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.games.PlayGames
    2023/02/04 12:37:57.334 20655 20677 Error Unity java.lang.ClassNotFoundException: com.google.android.gms.games.PlayGames
    2023/02/04 12:37:57.334 20655 20677 Error Unity at java.lang.Class.classForName(Native Method)
    2023/02/04 12:37:57.334 20655 20677 Error Unity at java.lang.Class.forName(Class.java:454)
    2023/02/04 12:37:57.334 20655 20677 Error Unity at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    2023/02/04 12:37:57.334 20655 20677 Error Unity at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
    2023/02/04 12:37:57.334 20655 20677 Error Unity at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
    2023/02/04 12:37:57.334 20655 20677 Error Unity at android.os.Handler.dispatchMessage(Handler.java:102)
    2023/02/04 12:37:57.334 20655 20677 Error Unity at android.os.Looper.loopOnce(Looper.java:226)
    2023/02/04 12:37:57.334 20655 20677 Error Unity at android.os.Looper.loop(Looper.java:313)
    2023/02/04 12:37:57.334 20655 20677 Error Unity at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
    2023/02/04 12:37:57.334 20655 20677 Error Unity Caused by: java.lang.ClassNotFoundException: com.google.android.gms.games.PlayGames
    2023/02/04 12:37:57.334 20655 20677 Error Unity ... 9 more
    2023/02/04 12:37:57.334 20655 20677 Error Unity at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
    2023/02/04 12:37:57.334 20655 20677 Error Unity at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <00000000000000000000000000000000>:0
    2023/02/04 12:37:57.334 20655 20677 Error Unity at UnityEngine.AndroidJavaClass._AndroidJa
    2023/02/04 12:38:06.422 20655 20936 Warn Choreographer Frame time is 0.020694 ms in the future! Check that graphics HAL is generating vsync timestamps using the correct timebase.
    2023/02/04 12:38:07.210 20655 20936 Warn Choreographer Frame time is 0.020751 ms in the future! Check that graphics HAL is generating vsync timestamps using the correct timebase.
    2023/02/04 12:38:10.209 20655 20655 Info ViewRootImpl@5ca8ae[UnityPlayerActivity] ViewPostIme pointer 0
    2023/02/04 12:38:10.321 20655 20655 Info ViewRootImpl@5ca8ae[UnityPlayerActivity] ViewPostIme pointer 1
    2023/02/04 12:38:10.340 20655 20677 Error Unity AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.games.PlayGames

    I am starting to wonder if I need to install Android Stuido and the SDK and Java etc seperately instead of trying to use the bundled version in Unity, as I just cannot get this to work. Last resort here is going to be messing around with SHA1 fingerprints using the "keytool" - which again is not noted in any documentation at all, but rather a last-gasp by the many other people trying to get this to work.

    Please, someone at Unity, how do I tackle this?
     
  4. BBO_Lagoon

    BBO_Lagoon

    Joined:
    Mar 2, 2017
    Posts:
    200
    N1ghtrunner likes this.
  5. N1ghtrunner

    N1ghtrunner

    Joined:
    Jan 5, 2015
    Posts:
    104
    Thank you for this! For the first time in days I can sign-in when building directly to my phone, as well as display the Leaderboard UI I created. I can see in my logs that authentication has succeeded! This is huge progress.On trying to ShowAchievementsUI I'm getting told that this has not been implemented, so moving on to the next thing.

    Edit: Just needed to Activate() Play Games to get the Achievements showing.

    Thank you.
     
    Last edited: Feb 6, 2023