- Home /
App crashes on google play login
I was having some problems with admob and google play services .aar files. I solved it using Play Services Resolver -> Force Resolve. But now whenever I create the apk the app crashes after the "Made with Unity" comes up. The app crashes because of the Login(); function as it works fine if I don't include it. This is the login function which I call at the starting of the game
public void Login(){
Social.localUser.Authenticate ((bool success) => {
});
}
HELP PLEASE!
Can you please add your full script where you use google play services :)
@hasitha here's the script I'm using. I made a brand new project without using admob. I have uploaded the apk to console and got the resources and the client id. But the game still crashes whenever I try to sign in. I'm using Unity 5.5.1f and play services plugin 0.9.42. Here's the script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GooglePlayGames;
using UnityEngine.SocialPlatforms;
public class googleplay : $$anonymous$$onoBehaviour {
public static googleplay instance;
void Awake(){
if (instance == null) {
instance = this;
}
}
void Start () {
PlayGamesPlatform.Activate ();
}
void Update () {
}
public void Login(){
Social.localUser.Authenticate ((bool success) => {
if(success){
Debug.Log("YESSS");
}
else{
Debug.Log("NOOOOOOO");
}
});
}
public void Show$$anonymous$$erboard(){
if (Social.localUser.authenticated) {
PlayGamesPlatform.Instance.Show$$anonymous$$erboardUI ($$anonymous$$erBoard.leaderboard_top_gunmen);
} else {
Login ();
}
}
}
As soon as I call Login from a button the game just closes itself. It's driving me nuts. Help! And Thank You!
Try updating to Unity 5.6.4p3. its the final version of unity 5 with bug fixes.
and try this also :
void Start ()
{
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder ().Build ();
PlayGamesPlatform.InitializeInstance (config);
PlayGamesPlatform.DebugLogEnabled = true; // check logs
PlayGamesPlatform.Activate ();
Social.localUser.Authenticate (success => {
if (success) {
Debug.Log ("SignIn successful");
} else {
Debug.Log ("SignIn failed");
}
});
}
check your ter$$anonymous$$al logs
Answer by SonicDirewolf · Nov 26, 2017 at 12:10 PM
Fixed it! Just Upgrade your Unity to 2017. It should work fine!
Your answer
Follow this Question
Related Questions
When I start my game on Android this crashes (google play problem) 0 Answers
Game crashes on start up after implementing Admob 0 Answers
Facebook login crash on Android. FB.Login 2 Answers
How to integrate new google play games services for leaderboard? 2 Answers
Google Play Games - game crashes after closing leaderboard 0 Answers