playgameservices / play-games-plugin-for-unity

Google Play Games plugin for Unity
Other
3.46k stars 966 forks source link

Authenticate doesn't work at all. #506

Closed PenguinsFly closed 9 years ago

PenguinsFly commented 9 years ago

Hey everyone, I have followed every step and I made a simple script for the very first scene and that scene doesn't have anything else but this script and the camera.

Here's the script:

using UnityEngine;
using System.Collections;
using GooglePlayGames;
using UnityEngine.SocialPlatforms;

public class GooglePlay : MonoBehaviour {

    void Start () {  
        PlayGamesPlatform.Activate();           
        Social.localUser.Authenticate((bool success) => {
            if (success) {
                Application.LoadLevel("First Scene");
            } else {
                Debug.Log("Something else happened");
            } 
        });
    }
}

The issue is, it doesn't authenticate NOR even ask my device to choose an account to log in. Nothing pops up but my the blank screen from the first scene and probably calling the Debug.Log function I've put at the else statement.

What did I do wrong?

claywilkinson commented 9 years ago

Can you post the log file? It will definitely have some clues about what is going on.

PenguinsFly commented 9 years ago

How and where can I find or get the log file?

Apologies, I'm still very new at this.

larykUA commented 9 years ago

Hello,

I have the similar problem. The log file :

I/Unity   ( 1010):  [Play Games Plugin DLL] 05/06/15 10:05:03 +03:00 DEBUG: Activating PlayGamesPlatform.
I/Unity   ( 1010):  [Play Games Plugin DLL] 05/06/15 10:05:03 +03:00 DEBUG: PlayGamesPlatform activated: GooglePlayGames.PlayGamesPlatform
I/Unity   ( 1010):  [Play Games Plugin DLL] 05/06/15 10:05:03 +03:00 DEBUG: Creating platform-specific Play Games client.
I/Unity   ( 1010):  [Play Games Plugin DLL] 05/06/15 10:05:03 +03:00 DEBUG: Creating real IPlayGamesClient

.....

D/GamesUnitySDK( 1010): Performing Android initialization of the GPG SDK
E/GamesNativeSDK( 1010): Can't register class com/google/android/gms/nearby/Nearby: an exception occurred.
E/GamesNativeSDK( 1010): Can't register class com/google/android/gms/nearby/connection/AppIdentifier: an exception occurred.
E/GamesNativeSDK( 1010): Can't register class com/google/android/gms/nearby/connection/AppMetadata: an exception occurred.
E/GamesNativeSDK( 1010): Can't register class com/google/android/gms/nearby/connection/Connections: an exception occurred.
E/GamesNativeSDK( 1010): Can't register class com/google/android/gms/nearby/connection/Connections$StartAdvertisingResult: an exception occurred.
E/GamesNativeSDK( 1010): Could not register one or more required Java classes.
I/Unity   ( 1010): InvalidOperationException: There was an error creating a GameServices object. Check for log errors from GamesNativeSDK
I/Unity   ( 1010):   at GooglePlayGames.Native.PInvoke.GameServicesBuilder.Build (GooglePlayGames.Native.PInvoke.PlatformConfiguration configRef) [0x00000] in <filename unknown>:0 
I/Unity   ( 1010):   at GooglePlayGames.Native.NativeClient.InitializeGameServices () [0x00000] in <filename unknown>:0 
I/Unity   ( 1010):   at GooglePlayGames.Native.NativeClient.Authenticate (System.Action`1 callback, Boolean silent) [0x00000] in <filename unknown>:0 
I/Unity   ( 1010):   at GooglePlayGames.PlayGamesPlatform.Authenticate (System.Action`1 callback, Boolean silent) [0x00000] in <filename unknown>:0 
I/Unity   ( 1010):   at GooglePlayGames.PlayGamesPlatform.Authenticate (System.Action`1 callback) [0x00000] in <filename unknown>:0 
I/Unity   ( 1010):   at MultiplayerController.userAuthentification () [0x00000] in <filename unknown>:0 
I/Unity   ( 1010):   at PlayersManager.Start () [0x00000] in <filename unknown>:0 

Please note, my code works as it should with the previous 0.9.15 version of GPGP.

Hope you will help me.

tyrmullen commented 9 years ago

@larykUI: It looks like you are missing some of the required Google Play Services library classes. If your code works with the previous version of GPGP then this is probably because you need to update to a newer version of the GPS library. This is consistent with the error you are seeing, since the "nearby" classes were newly added.

PenguinsFly commented 9 years ago

Here's what I got...

Registering platform support modules:

Platform assembly: D:\1. DM\Unity\Editor\Data\Mono\lib\mono\2.0\Boo.Lang.Compiler.dll (this message is harmless)
Platform assembly: D:\1. DM\Unity\Editor\Data\Mono\lib\mono\2.0\Boo.Lang.dll (this message is harmless)
Platform assembly: D:\1. DM\Unity\Editor\Data\Mono\lib\mono\2.0\Boo.Lang.Parser.dll (this message is harmless)
Platform assembly: D:\1. DM\Unity\Editor\Data\Mono\lib\mono\2.0\UnityScript.Lang.dll (this message is harmless)
Registered platform support modules in: 0.0341314s.

Native extension for OSXStandalone target not found
Native extension for WindowsStandalone target not found
Native extension for LinuxStandalone target not found
Native extension for WebGL target not found
Native extension for BlackBerry target not found
Native extension for Android target not found
Load scene 'Temp/__EditModeScene' time: 35.202160 ms 
Something else happened
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
GooglePlay:<Start>m__BD(Boolean) (at Assets\Scripts\General Scripts\GooglePlay.cs:15)
GooglePlayGames.BasicApi.DummyClient:Authenticate(Action`1, Boolean) (at Assets\Google Plugin\GooglePlayGames\BasicApi\DummyClient.cs:31)
GooglePlayGames.PlayGamesPlatform:Authenticate(Action`1, Boolean) (at Assets\Google Plugin\GooglePlayGames\ISocialPlatform\PlayGamesPlatform.cs:301)
GooglePlayGames.PlayGamesPlatform:Authenticate(Action`1) (at Assets\Google Plugin\GooglePlayGames\ISocialPlatform\PlayGamesPlatform.cs:271)
GooglePlayGames.PlayGamesLocalUser:Authenticate(Action`1) (at Assets\Google Plugin\GooglePlayGames\ISocialPlatform\PlayGamesLocalUser.cs:44)
GooglePlay:Start() (at Assets\Scripts\General Scripts\GooglePlay.cs:11)

(Filename: Assets/Scripts/General Scripts/GooglePlay.cs Line: 15)
claywilkinson commented 9 years ago

This line GooglePlayGames.BasicApi.DummyClient:Authenticate indicates that you are running this in the editor. Google Play Games can only run on a device. The DummyClient is just a placeholder, but does not actually do anything.

PenguinsFly commented 9 years ago

Yeah, I was aware of that. But if I build the game and put it on my android device, it does nothing at all.

"Nothing pops up but my the blank screen from the first scene and probably calling the Debug.Log function I've put at the else statement." <-- This happens on my android device.

claywilkinson commented 9 years ago

Can you get the log when the app is running on your device? You can run adb logcat from a terminal window. All the details on logcat are at: http://developer.android.com/tools/help/logcat.html Then we'll know for sure :)

PenguinsFly commented 9 years ago

I will try doing that later as soon as I'm home.. I'm still inexperienced with this logcat thingy so I'll have to learn it for awhile.

PenguinsFly commented 9 years ago

Hiya! I was able to figure out how to do it and now I found these lines: http://pastebin.com/kqwvpQBx

Hope it helps :disappointed:

claywilkinson commented 9 years ago

@PenguinsFly - great! it does help :)

Not being able to register these classes indicates that the Android SDK is not up to date. Make sure you have the Google Play Services SDK installed (in SDK Manager scroll down to the "Extras" section). Once you have that, rebuild your app.

PenguinsFly commented 9 years ago

Yup. I've made sure I have them updated before building the game.

Here's a screenshot of it: http://puu.sh/hEN4s/0b15d1c509.png

Anything wrong?

claywilkinson commented 9 years ago

Hmm. Check that the Android SDK is pointing to where the SDK is installed, are there other messages in the log before it cannot register those classes?

PenguinsFly commented 9 years ago
D/Sensors (  998): AccelerometerSensor: mEnabled = 1

W/SensorService(  998): sensor 5f616363 already enabled in connection 0x56d35918 (ignoring)

D/Sensors (  998): AccelerometerSensor: mEnabled = 1

D/dalvikvm( 9659): Trying to load lib /mnt/asec/com.PenguinsFly.Quickly-1/lib/libgpg.so 0x419c4dc0

D/dalvikvm( 9659): Added shared lib /mnt/asec/com.PenguinsFly.Quickly-1/lib/libgpg.so 0x419c4dc0

These are before the log on the pastebin.com link.

claywilkinson commented 9 years ago

What version of Android are you running on your device and which version of Google Play Services is installed. You can tell the version by dragging the "Google Settings" application to the AppInfo at the top of the screen.

PenguinsFly commented 9 years ago

On my phone, it's 4.4.2 android and version 7.3.29.

This issue also occurs on my android emulator on my computer(bluestacks).

claywilkinson commented 9 years ago

The emulator will not have google play services installed - does it work on your phone?

PenguinsFly commented 9 years ago

Nope, it doesn't work. I got the logs from my phone.

Boogscraft commented 9 years ago

Not sure if you checked this yet, but in Unity, under Edit-> Preferences, External Tools, make sure the Android SDK path is set right. I believe the the default path for windows is now \Users[User]\AppData\Local\Android\sdk on the System drive, but that might vary.

claywilkinson commented 9 years ago

One other long shot is maybe you have multiple copies of the SDK installed, and the SDK manager is updating one version, and the preferences are pointing to another?

PenguinsFly commented 9 years ago

I just checked them out now and they're all set to the correct ones. Would re installing SDK help?

Boogscraft commented 9 years ago

I'm not sure if this would cause the issues above, but also check in Unity under Google Play Games -> Android Setup that your Application ID is set there correctly. You can find the ID in the Google Play Developer Console, under Game Services (the gamepad icon). When you select your Game from that list, the ID is under its Name and Icon in the upper left.

PenguinsFly commented 9 years ago

Hmm. So I tried putting the ID again and I'm getting this message: http://puu.sh/hEXrS/8c366f79bd.png

I think there's a problem with my plugin in general. What do you guys think?

Boogscraft commented 9 years ago

The slashes in that path that it is trying to copy from looks off: D:/SDK\extras\google....

PenguinsFly commented 9 years ago

For some reason, it is. It's the same at my Preference: http://puu.sh/hEY7w/4541e36d6c.png

I tried changing it back and it's still like that. Is it an issue?

Boogscraft commented 9 years ago

Probably not, it's likely just a display issue then. Can you confirm that the file it's looking for exists in the path it's trying? If it does, I would probably go the route of removing the SDK folder and using the Manager to redownload it.

PenguinsFly commented 9 years ago

Omg, I've put them on a folder... I wonder if it helps if I set them to their default place...

claywilkinson commented 9 years ago

Assets/Plugins is a "magic" name that Unity uses. Is that the one you are referring to?

PenguinsFly commented 9 years ago

Importing the Google Play Services Plugin in Unity gives me 2 folders inside the asset folder and that is the GooglePlayGames folder and the Plugins folder. I've put them on a different folder After configuring things so I think that is the issue...

PenguinsFly commented 9 years ago

It worked somehow now! I was finally able to see the sign in authenticating part(phew!) but now, the problem is, it's not authenticating.

claywilkinson commented 9 years ago

great! that is progress :) if you reinstalled the plugin, you'll need to re-run the Android setup. Also check the appId and bundle ID in the play console match what you have configured in your unity project. Finally, check the user id you are logging in as is a tester for the game in the play console.

PenguinsFly commented 9 years ago

OMG! That worked! Adding the tester account for the game thing. I've been logging in as a different account.

Everything is working perfectly now.

Thank you everyone so much for helping me. I've been very frustrated about this for a week now. I feel so relieved! Slightly embarrassed about how my mistakes are this rookie level though. But np!

Thank you thank you thank you!!!

claywilkinson commented 9 years ago

Great News! We've all been there - Best of luck in your development.

ghost commented 9 years ago

Happened the same to me and after reading this thread the solution was: -> Update the Android SDK Google Play Services package to a version >=r23 -> Go to Window | Google Play Games | Setup | Android Setup... and click on Setup (this will update the local copy of the library) -> Rebuild