Search Unity

Google Play Not Working in new Build??

Discussion in 'Scripting' started by DoublePixelStudio, Feb 21, 2017.

  1. DoublePixelStudio

    DoublePixelStudio

    Joined:
    Jan 30, 2017
    Posts:
    69
    I've setup Google Play like i have for every game in th elast four years.. I Called Activate in start, i called if auth and sucess then log in.. All that has be added. Ive also added emails for test accounts, and my APK has been uploaded for the past 24 hours under Beta testing. Yet, when it goes to authenticate in the game, it crashes!... Every single time. Anyone got anyclues?? i ran the logcat and this is all i got..


    C:\Users\shawn\AppData\Local\Android\sdk\platform-tools>adb logcat -s Unity
    --------- beginning of /dev/log/system
    --------- beginning of /dev/log/main
    E/Unity (24866): Unable to find AudioPluginMsHRTF
    E/Unity (24866): Unable to find AudioPluginOculusSpatializer
    D/Unity (24866): GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_debug_labelGL_EXT_debug_markerGL_EXT_robustness GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_depth_texture_cube_map GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_vertex_type_10_10_10_2 GL_OES_vertex_array_object GL_QCOM_alpha_test GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_AMD_compressed_3DC_texture GL_EXT_sRGB GL_EXT_texture_filter_anisotropic
    W/Unity (24866): OnLevelWasLoaded was found on DOTweenComponent
    W/Unity (24866): This message has been deprecated and will be removed in a later version of Unity.
    W/Unity (24866): Add a delegate to SceneManager.sceneLoaded instead to get notifications after scene loading has completed
    W/Unity (24866):
    W/Unity (24866): (Filename: Line: 382)
    W/Unity (24866):
    I/Unity (24866): NullReferenceException: Object reference not set to an instance of an object
    I/Unity (24866): at GameCenter.<Awake>m__0 (Boolean success) [0x00000] in <filename unknown>:0
    I/Unity (24866): at UnityEngine.SocialPlatforms.Local.UnityEngine.SocialPlatforms.ISocialPlatform.Authenticate (ILocalUser user, System.Action`1 callback) [0x00000] in <filename unknown>:0
    I/Unity (24866): at UnityEngine.SocialPlatforms.Impl.LocalUser.Authenticate (System.Action`1 callback) [0x00000] in <filename unknown>:0
    I/Unity (24866): at GameCenter.Awake () [0x00000] in <filename unknown>:0
    I/Unity (24866):
    I/Unity (24866): (Filename: Line: -1)
    I/Unity (24866):
    W/Unity (24866): The referenced script on this Behaviour (Game Object 'MainCanvas') is missing!
    W/Unity (24866):
    W/Unity (24866): (Filename: Line: 1754)
    W/Unity (24866):
    I/Unity (24866): Building GPG services, implicitly attempts silent auth
    I/Unity (24866):
    I/Unity (24866): (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
    I/Unity (24866):
    E/Unity (25358): Unable to find AudioPluginMsHRTF
    E/Unity (25358): Unable to find AudioPluginOculusSpatializer
    D/Unity (25358): GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_debug_labelGL_EXT_debug_markerGL_EXT_robustness GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_depth_texture_cube_map GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_vertex_type_10_10_10_2 GL_OES_vertex_array_object GL_QCOM_alpha_test GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_AMD_compressed_3DC_texture GL_EXT_sRGB GL_EXT_texture_filter_anisotropic
    W/Unity (25358): OnLevelWasLoaded was found on DOTweenComponent
    W/Unity (25358): This message has been deprecated and will be removed in a later version of Unity.
    W/Unity (25358): Add a delegate to SceneManager.sceneLoaded instead to get notifications after scene loading has completed
    W/Unity (25358):
    W/Unity (25358): (Filename: Line: 382)
    W/Unity (25358):
    I/Unity (25358): NullReferenceException: Object reference not set to an instance of an object
    I/Unity (25358): at GameCenter.<Awake>m__0 (Boolean success) [0x00000] in <filename unknown>:0
    I/Unity (25358): at UnityEngine.SocialPlatforms.Local.UnityEngine.SocialPlatforms.ISocialPlatform.Authenticate (ILocalUser user, System.Action`1 callback) [0x00000] in <filename unknown>:0
    I/Unity (25358): at UnityEngine.SocialPlatforms.Impl.LocalUser.Authenticate (System.Action`1 callback) [0x00000] in <filename unknown>:0
    I/Unity (25358): at GameCenter.Awake () [0x00000] in <filename unknown>:0
    I/Unity (25358):
    I/Unity (25358): (Filename: Line: -1)
    I/Unity (25358):
    W/Unity (25358): The referenced script on this Behaviour (Game Object 'MainCanvas') is missing!
    W/Unity (25358):
    W/Unity (25358): (Filename: Line: 1754)
    W/Unity (25358):
    I/Unity (25358): Building GPG services, implicitly attempts silent auth
    I/Unity (25358):
    I/Unity (25358): (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
    I/Unity (25358):
    E/Unity (26127): Unable to find AudioPluginMsHRTF
    E/Unity (26127): Unable to find AudioPluginOculusSpatializer
    D/Unity (26127): GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_debug_labelGL_EXT_debug_markerGL_EXT_robustness GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_depth_texture_cube_map GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_vertex_type_10_10_10_2 GL_OES_vertex_array_object GL_QCOM_alpha_test GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_AMD_compressed_3DC_texture GL_EXT_sRGB GL_EXT_texture_filter_anisotropic
    W/Unity (26127): OnLevelWasLoaded was found on DOTweenComponent
    W/Unity (26127): This message has been deprecated and will be removed in a later version of Unity.
    W/Unity (26127): Add a delegate to SceneManager.sceneLoaded instead to get notifications after scene loading has completed
    W/Unity (26127):
    W/Unity (26127): (Filename: Line: 382)
    W/Unity (26127):
    I/Unity (26127): NullReferenceException: Object reference not set to an instance of an object
    I/Unity (26127): at GameCenter.<Awake>m__0 (Boolean success) [0x00000] in <filename unknown>:0
    I/Unity (26127): at UnityEngine.SocialPlatforms.Local.UnityEngine.SocialPlatforms.ISocialPlatform.Authenticate (ILocalUser user, System.Action`1 callback) [0x00000] in <filename unknown>:0
    I/Unity (26127): at UnityEngine.SocialPlatforms.Impl.LocalUser.Authenticate (System.Action`1 callback) [0x00000] in <filename unknown>:0
    I/Unity (26127): at GameCenter.Awake () [0x00000] in <filename unknown>:0
    I/Unity (26127):
    I/Unity (26127): (Filename: Line: -1)
    I/Unity (26127):
    W/Unity (26127): The referenced script on this Behaviour (Game Object 'MainCanvas') is missing!
    W/Unity (26127):
    W/Unity (26127): (Filename: Line: 1754)
    W/Unity (26127):
    I/Unity (26127): Building GPG services, implicitly attempts silent auth
    I/Unity (26127):
    I/Unity (26127): (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
    I/Unity (26127):
     
  2. Strangiato

    Strangiato

    Joined:
    Oct 24, 2014
    Posts:
    18
    Looks like it is trying to initialize GameCenter?
     
  3. DoublePixelStudio

    DoublePixelStudio

    Joined:
    Jan 30, 2017
    Posts:
    69
    Yes, GameCenter is the script that logs you in like so..

    Code (CSharp):
    1.  public void Start()
    2.     {
    3.  
    4.      
    5.         Social.localUser.Authenticate((bool success) =>
    6.         {
    7.             if (success)
    8.             {
    9.                 Debug.Log("Login Sucess");
    10.             }
    11.             else
    12.             {
    13.                 Debug.Log("Login failed");
    14.             }
    15.         });
    16.  
    17.     }
    so when the game starts youll get logged in.. Then i have another script calle Awakened that activates play store like so..

    Code (CSharp):
    1.  void Awake()
    2.     {
    3.         PlayGamesPlatform.Activate();
    4.      
    5.     }
    so the game starts, it activates google play, then it initializes the gamecenter script on start that logs the user in. But when ever the game starts it crashes.. I took the activate off wake and the game works fine, but i cant log in to leaderboard or anything.. says achieves not implemented.. which in my understanding means i havent activated google play..
     
  4. Strangiato

    Strangiato

    Joined:
    Oct 24, 2014
    Posts:
    18
    The error message is
    I/Unity (26127): NullReferenceException: Object reference not set to an instance of an object
    I/Unity (26127): at GameCenter.<Awake>m__0 (Boolean success) [0x00000] in <filename unknown>:0

    That means there is a reference in your Awake function that hasn't been assigned a value.

    It looks like the only possible reference in that function is PlayGamePlatform.

    Where is that defined? Are you assigning an object to it?
     
  5. DoublePixelStudio

    DoublePixelStudio

    Joined:
    Jan 30, 2017
    Posts:
    69
    Ok.. I imported the Google Play Games Package from github into my Unity Project. I have all the stuff i need downloaded. I have the SDK Manager downloaded and all the necessary files are downloaded as well. I have a script called, GameCenter, its in C#.. This is the Script..

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using GooglePlayGames;
    4. using UnityEngine.SocialPlatforms;
    5. using UnityEngine.UI;
    6. using GooglePlayGames.BasicApi;
    7.  
    8. public class GameCenter : MonoBehaviour {
    9.  
    10.    // public GameObject signIn;
    11.     public GameObject leader;
    12.     public GameObject achieve;
    13.  
    14.  
    15.     public string leaderboard;
    16.     private Text signInButtonText;
    17.     private Text authStatus;
    18.  
    19.      void Awake()
    20.     {
    21.         PlayGamesPlatform.Activate();
    22.      
    23.        
    24.     }
    25.  
    26.  
    27.     public void Start()
    28.     {
    29.  
    30.      
    31.         Social.localUser.Authenticate((bool success) =>
    32.         {
    33.             if (success)
    34.             {
    35.                 Debug.Log("Login Sucess");
    36.             }
    37.             else
    38.             {
    39.                 Debug.Log("Login failed");
    40.             }
    41.         });
    42.  
    43.     }
    44.  
    45.    
    46.  
    47.  
    48.  
    49.  
    50.     public void ShowLeaderBoard()
    51.     {
    52.  
    53.         ((PlayGamesPlatform)Social.Active).ShowLeaderboardUI(leaderboard);
    54.     }
    55.  
    56.     public void ShowAchieve()
    57.     {
    58.  
    59.         Social.ShowAchievementsUI();
    60.  
    61.     }
    62.  
    63.     public void OnLogOut()
    64.     {
    65.         ((PlayGamesPlatform)Social.Active).SignOut();
    66.     }
    67.  
    68. }
    69.  


    On the Awakw function playgames is called to activate.. Then on start function its called to sign the user in.. There is nothing missing to where it shouldnt activate google play and then sign in the user.. I also added using GooglePlayGames; and using UnityEngine.SocialPlatforms; at the begining..
     
  6. DoublePixelStudio

    DoublePixelStudio

    Joined:
    Jan 30, 2017
    Posts:
    69
    I figured it out.. for anyone using 10.2.0 in google play and the game crashes on authenticate, its because the 10.2.0 isnt comptable with Unity, or unity isnt compatable with it, either way, youll need to roll back to 10.0.1.. to do this, follow these steps...


    1. Go to Assets (the asset tab at the top of unity)> Play Services Resolver > Android Resolver > Settings
    2. Un-tick Enable Background resolution (This will suppress the update notifications once we downgrade the .aar files)
    3. Go to <android_sdk_path>\extras\google\m2repository\com\google\android\gms
    4. Inside each of the folders there are version folders (such as 10.0.1, 10.2.0). And inside those are the .aar files we need.
    5. We will need the following files:
    • play-services-ads-10.0.1.aar
    • play-services-ads-lite-10.0.1.aar
    • play-services-auth-10.0.1.aar
    • play-services-auth-base-10.0.1.aar
    • play-services-base-10.0.1.aar
    • play-services-basement-10.0.1.aar
    • play-services-clearcut-10.0.1.aar
    • play-services-drive-10.0.1.aar
    • play-services-games-10.0.1.aar
    • play-services-gass-10.0.1.aar
    • play-services-nearby-10.0.1.aar
    • play-services-tasks-10.0.1.aar
    1. Under <unity_project_path>\Assets\Plugins\Android delete the 10.2.0 versions of the .aar files above, with their META files.
    2. Copy the 10.0.1 versions over
    3. Build and run your project.
    If you don't do Step 2, Play Services Resolver will keep asking you to update these .aar files.

    I hope I was able to help anyone encountering this issue.
     
    Dorian01, mutawe and SiliconDroid like this.
  7. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    302
    Awesome work on figuring it out and many thanks for sharing! :)
     
  8. HypoXic5665

    HypoXic5665

    Joined:
    Sep 10, 2012
    Posts:
    12
    Thank you @District3Studios. This problem had me stuck for 2 days and is rather upsetting. However this seems to fix it for now.
     
  9. mutawe

    mutawe

    Joined:
    May 27, 2015
    Posts:
    1
    dude .. swear to god .. I love you more than my GF,, TY so much
     
    andrew_2992 likes this.
  10. hickna

    hickna

    Joined:
    Mar 14, 2013
    Posts:
    26
    Unfortunately this solution is not working to me... I did exactly as described, step-by-step without success. My application now is not loading... Just crash after these changes. :/
     
  11. Bertjuhh

    Bertjuhh

    Joined:
    Feb 1, 2017
    Posts:
    3
    Same here @ricna-net, for me the auth part still crashes my app.
     
  12. VukSDev

    VukSDev

    Joined:
    Mar 2, 2017
    Posts:
    2
    Solved it @Bertjuhh ?

    I have done literally everything the internet has to say on this topic, 0 luck, the game still crashes, 2 weeks now.

    Switching aars to 10.0.1 didn't help, neither did changing signing keys on google play console, neither using older versions of the plugin, each and every time I get a crash when I attempt to sign in, both Social.localUser.Authenticate() and the Instance method.

    The only thing I could get is "Building GPG services, implicitly attempts silent auth", followed by "PackageManager(884): Failure retrieving resources for com.somecompany.somegame: Resource ID #0x0"
    after using adb log.

    Any clues on what that might mean? I have pasted the resource info where it said I should paste it. I don't know what this part means though:
    <!--
    Google Play game services IDs.
    Save this file as res/values/games-ids.xml in your project.
    -->

    But I created several copies of that file and even created folders on "random" places with that file in it. No change.

    7 internets to the one who has any idea
     
  13. hickna

    hickna

    Joined:
    Mar 14, 2013
    Posts:
    26
    I needed to create a new game...
     
  14. abramovks

    abramovks

    Joined:
    Sep 28, 2018
    Posts:
    1
    This helped me.

    https://github.com/playgameservices/play-games-plugin-for-unity/issues/2217#issuecomment-417619382

    Can confirm this works:
    open template-AndroidManifest.txt
    "\ APP_ID" to "\u003__APP_ID__"
    setup GPGS from Unity (press Window/Google Play Services/Setup)



    True, after the correction, I received the error "Authentification failed". But it was a problem with SHA-1. It was decided when I did
    keytool -exportcert -keystore user.keystore -list -v
    And put the correct SHA-1 in https://console.developers.google.com/apis/credentials in the application settings.
     
  15. YoungestSneakerHunter

    YoungestSneakerHunter

    Joined:
    May 1, 2020
    Posts:
    2
    Unfortunately there is no "Background resolution" in my settings. There is also no "m2repository" directory in the android_sdk_path>\extras\google path and there are no "10.2.0" version .aar files in <unity_project_path>\Assets\Plugins\Android. That's probably because I am using a new Version of the GPGS plugin for unity. It seems like there isn't ANYONE having this problem in 2020 as me. Is there any way to fix this??? Please help. I'm now stuck for more than a week...