playgameservices / play-games-plugin-for-unity

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

Can't sign in when adding .RequestEmail on Xiaomi devices #1867

Open pooyakn opened 7 years ago

pooyakn commented 7 years ago

Hi. I have a problem with getting user email on Xiaomi devices. When I add . RequestEmail to configuration builder, the account chooser ui doesn't show up on Xiaomi devices and user can't login. But on other devices it's okay, and when i remove that part, it's okay on xiaomies too. I'm using the latest .39a plugin, and have updated google play services in sdk manager.

here's log:

I/Unity   ( 5277): Starting Auth with token client.
I/Unity   ( 5277):
I/Unity   ( 5277): (Filename: ./artifacts/generated/common/runtime/DebugBindings
.gen.cpp Line: 51)
I/Unity   ( 5277):
W/Unity   ( 5277): !!! [Play Games Plugin DLL] 08/07/17 22:46:50 +04:30 WARNING:
 Creating new PlayGamesPlatform
W/Unity   ( 5277):
W/Unity   ( 5277): (Filename: ./artifacts/generated/common/runtime/DebugBindings
.gen.cpp Line: 51)
W/Unity   ( 5277):
I/Unity   ( 5277):  [Play Games Plugin DLL] 08/07/17 22:46:50 +04:30 DEBUG: Acti
vating PlayGamesPlatform.
I/Unity   ( 5277):
I/Unity   ( 5277): (Filename: ./artifacts/generated/common/runtime/DebugBindings
.gen.cpp Line: 51)
I/Unity   ( 5277):
I/Unity   ( 5277):  [Play Games Plugin DLL] 08/07/17 22:46:50 +04:30 DEBUG: Play
GamesPlatform activated: GooglePlayGames.PlayGamesPlatform
I/Unity   ( 5277):
I/Unity   ( 5277): (Filename: ./artifacts/generated/common/runtime/DebugBindings
.gen.cpp Line: 51)
I/Unity   ( 5277):
I/Unity   ( 5277):  [Play Games Plugin DLL] 08/07/17 22:46:50 +04:30 DEBUG: Crea
ting platform-specific Play Games client.
I/Unity   ( 5277):
I/Unity   ( 5277): (Filename: ./artifacts/generated/common/runtime/DebugBindings
.gen.cpp Line: 51)
I/Unity   ( 5277):
I/Unity   ( 5277):  [Play Games Plugin DLL] 08/07/17 22:46:50 +04:30 DEBUG: Crea
ting Android IPlayGamesClient Client
I/Unity   ( 5277):
I/Unity   ( 5277): (Filename: ./artifacts/generated/common/runtime/DebugBindings
.gen.cpp Line: 51)
I/Unity   ( 5277):
I/Unity   ( 5277): —— [0] — 2097177
I/Unity   ( 5277):
I/Unity   ( 5277): (Filename: ./artifacts/generated/common/runtime/DebugBindings
.gen.cpp Line: 51)
I/Unity   ( 5277):
I/Unity   ( 5277): Building GPG services, implicitly attempts silent auth
I/Unity   ( 5277):
I/Unity   ( 5277): (Filename: ./artifacts/generated/common/runtime/DebugBindings
.gen.cpp Line: 51)
I/Unity   ( 5277):
I/Unity   ( 5277):  [Play Games Plugin DLL] 08/07/17 22:47:09 +04:30 DEBUG: Star
ting Auth Transition. Op: SIGN_IN status: 13
I/Unity   ( 5277):
I/Unity   ( 5277): (Filename: ./artifacts/generated/common/runtime/DebugBindings
.gen.cpp Line: 51)
I/Unity   ( 5277):
I/Unity   ( 5277):  [Play Games Plugin DLL] 08/07/17 22:47:09 +04:30 DEBUG: Invo
king callbacks, AuthState changed from silentPending to Unauthenticated.
I/Unity   ( 5277):
I/Unity   ( 5277): (Filename: ./artifacts/generated/common/runtime/DebugBindings
.gen.cpp Line: 51)
I/Unity   ( 5277):
I/Unity   ( 5277):  [Play Games Plugin DLL] 08/07/17 22:47:09 +04:30 DEBUG: ther
e are pending auth callbacks - starting AuthUI
I/Unity   ( 5277):
I/Unity   ( 5277): (Filename: ./artifacts/generated/common/runtime/DebugBindings
.gen.cpp Line: 51)
I/Unity   ( 5277):
I/Unity   ( 5277): else  8/7/2017
I/Unity   ( 5277):
I/Unity   ( 5277): (Filename: ./artifacts/generated/common/runtime/DebugBindings
.gen.cpp Line: 51)
I/Unity   ( 5277):
I/Unity   ( 5277):  [Play Games Plugin DLL] 08/07/17 22:47:09 +04:30 DEBUG: Star
ting Auth Transition. Op: SIGN_IN status: ERROR_NOT_AUTHORIZED
I/Unity   ( 5277):
I/Unity   ( 5277): (Filename: ./artifacts/generated/common/runtime/DebugBindings
.gen.cpp Line: 51)
I/Unity   ( 5277):
I/Unity   ( 5277):  [Play Games Plugin DLL] 08/07/17 22:47:09 +04:30 DEBUG: Auth
State == Unauthenticated calling auth callbacks with failure
I/Unity   ( 5277):
I/Unity   ( 5277): (Filename: ./artifacts/generated/common/runtime/DebugBindings
.gen.cpp Line: 51)
I/Unity   ( 5277):
I/Unity   ( 5277):  [Play Games Plugin DLL] 08/07/17 22:47:09 +04:30 DEBUG: Invo
king user callback on game thread
I/Unity   ( 5277):
I/Unity   ( 5277): (Filename: ./artifacts/generated/common/runtime/DebugBindings
.gen.cpp Line: 51)
I/Unity   ( 5277):
I/Unity   ( 5277): Starting Auth with token client.
I/Unity   ( 5277):
I/Unity   ( 5277): (Filename: ./artifacts/generated/common/runtime/DebugBindings
.gen.cpp Line: 51)
I/Unity   ( 5277):
I/Unity   ( 5277): —— [0] — 2097177
I/Unity   ( 5277):

Thanks.

claywilkinson commented 7 years ago

Can you share an unfiltered log? There are important messages that are not in the Unity category.

pooyakn commented 7 years ago

Here's full log (without -s Unity) https://pastebin.com/0DbxbCQB

pooyakn commented 7 years ago

@claywilkinson did you find out anything?

pooyakn commented 7 years ago

@claywilkinson Is there anything wrong with my log?

claywilkinson commented 7 years ago

Apologies for the slow response. I see this in the log: E/Parcel ( 1377): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.auth.api.signin.internal.SignInConfiguration" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]]

Do you have play-services-auth-*.aar in your project?

pooyakn commented 7 years ago

@claywilkinson It's fine. I have these in my Plugin folder: "play-services-auth-11.0.4" and "play-services-auth-base-11.0.4". and if there is something wrong with authentication, how is it possible to sign in on other devices?

claywilkinson commented 7 years ago

Hmm. Strange. Would you mind trying it with the Minimal sample (so we have the same code)? and share the full log? Also, which version of Android, Play Games App, and Play Game Services is installed on that device?

pooyakn commented 7 years ago

@claywilkinson Minimal sample log (it didn't work): https://pastebin.com/cvqBFUxX

Android: 5.1.1 Google Play Services: 11.3.02 Google Play Games: 5.2.25

claywilkinson commented 7 years ago

Thanks for the info. I see this line in the log: E/TokenFragment( 7709): Google SignIn Result is null? Which comes from https://github.com/playgameservices/play-games-plugin-for-unity/blob/master/source/SupportLib/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/TokenFragment.java#L333

Unfortunately, it does not print out the resultCode. Do you think you can add the log statement and rebuild? I can try to add it and make an updated plugin, but I might not get to it today..

pooyakn commented 7 years ago

@claywilkinson Thanks for your quick response. How should I add that? or more specifically, I must say: "WHAT should I add, and to WHERE?"

claywilkinson commented 7 years ago

:D on that like 333 add something like Log.e(TAG,"Failure getting result: " + resultCode);

Then recompile that java project and copy the jar file out. I'll try to share a gist with the updated code in about an hour or so...

claywilkinson commented 7 years ago

you can download the updated jar from this gist: https://gist.github.com/claywilkinson/32cdb00e9a391833ab3e1eae52e1535f

It is based on 0.9.40 - but I don't think there are any differences that would make you have to update. B

pooyakn commented 7 years ago

Thanks! I was still struggling with android studio. :D

claywilkinson commented 7 years ago

No problem - hopefully the added logging will point us in the right direction.

pooyakn commented 7 years ago

@claywilkinson Sorry for late response. Last night couldn't grab a xiaomi device. Here's new log: https://pastebin.com/STKhbqJt

claywilkinson commented 7 years ago

No worries - I've passed it along to some colleagues who can help too - It is strange that the result is success but the result object is not present. I'll keep you posted.

claywilkinson commented 7 years ago

@Starless-Sky - Apparently there are some xiaomi devices that do not have Google Play Services installed on them. This can cause this problem. The difference is when you request email, the code is using the GoogleSignIn API. Without the request for email, it uses the Games sign-in which does not access the user information.

For reference here is a related issue: https://github.com/googlesamples/google-services/issues/240

In a future release of Google SignIn API it will return a proper error code, so it is a little easier to diagnose.

pooyakn commented 7 years ago

@claywilkinson I have Google Play Services and Google Play Games installed and they are official versions, cause I am on golbal rom, not Chinese one. Also I have other games like 8 ball pool (mini clip) installed and it works fine. (8 ball pool also has the second screen that I have to give permission to access my data (other than my Play Games Profile), but that game is not made with Unity.

Another thing is when I add RequestEmail to the builder, It doesn't show the account selector UI (that green thing). I assume it tries to sign in silently, but fails when tries to show that second one to give permission to accees my email. However when I remove the RequestEmail thing, It signs in just fine, and the account selector UI does show up.

That's my assumption. I don't know if it's right, but if there's something I can test to help in the diagnosis process, please tell.

claywilkinson commented 7 years ago

Thanks - can you share the model and version of the device so I can pass that along too?

pooyakn commented 7 years ago

You're welcome. Xiaomi redmi note 3 - Snapdragon version http://m.gsmarena.com/xiaomi_redmi_note_3-7863.php#global

on Android 5.1 MIUI 8

claywilkinson commented 7 years ago

@Starless-Sky - I got hold of a redmi note 3 and it is working. I added some more error handling that should help to the jar in https://gist.github.com/claywilkinson/32cdb00e9a391833ab3e1eae52e1535f

If you would not mind downloading it again and trying it out.

My versions of software are a little different (for example play services is 11.0.55) and I am using play-services-auth-11.0.2, but I don't think that will make a difference.

Thanks!

atul109 commented 6 years ago

Somewhat same issue here, but I tried removing .RequestEmail() still not working in Xiaomi redmi note 3 MIUI 9 (Android 6.01). I am using Google play games plugin 0.9.40 Works in Nokia 3 (Android 7), Xiaomi redmi (Android 4.4), LYF Flame 8 (Android 5.1)