问题
I work with Google Play Games Services. I took the code from the official example. Try with API 27 and with API 17.
All works only under one account (owner Google Developer Console), under any other - no.
I get this:
E/AndroidRuntime: FATAL EXCEPTION: GoogleApiHandler
java.lang.IllegalStateException: Games APIs requires https://www.googleapis.com/auth/games_lite function.
at com.google.android.gms.common.internal.zzbq.zza(Unknown Source)
at com.google.android.gms.games.internal.GamesClientImpl.zzb(Unknown Source)
at com.google.android.gms.common.internal.zzab.<init>(Unknown Source)
at com.google.android.gms.common.internal.zzab.<init>(Unknown Source)
at com.google.android.gms.games.internal.GamesClientImpl.<init>(Unknown Source)
at com.google.android.gms.games.Games$zzb.zza(Unknown Source)
at com.google.android.gms.common.api.GoogleApi.zza(Unknown Source)
at com.google.android.gms.common.api.internal.zzbo.<init>(Unknown Source)
at com.google.android.gms.common.api.internal.zzbm.zzb(Unknown Source)
at com.google.android.gms.common.api.internal.zzbm.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:153)
at android.os.HandlerThread.run(HandlerThread.java:60)
I checked everything and as described here.
My gradle:
def gmsVersion = '12.0.1'
implementation "com.google.android.gms:play-services-games:$gmsVersion"
implementation "com.google.android.gms:play-services-auth:$gmsVersion"
implementation "com.google.android.gms:play-services-base:$gmsVersion"
implementation "com.google.android.gms:play-services-identity:$gmsVersion"
and
isGooglePlayServicesAvailable = SUCCESS
I spent a very long time looking for a solution, but I did not find it.
回答1:
True path is requestScopes(Games.SCOPE_GAMES_LITE):
GoogleSignInOptions gso = new GoogleSignInOptions
.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestScopes(Games.SCOPE_GAMES_LITE)
.requestEmail()
.build();
回答2:
Following this Google Game Doc should be enough: https://developers.google.com/games/services/android/signin
You should use:
GoogleSignInOptions gso = new GoogleSignInOptions
.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN)
.requestEmail()
.build();
回答3:
I had the same issue.
In my case, it happened when I added a new developer in my google console.
When some changes are made in the console, even though google gives us a green flag instantly, it is taking some time to get activated. My problem got solved without me doing anything but to wait a couple of hrs.
Note that as per Developer's Blog,
GoogleSignInOptions gso = new GoogleSignInOptions.Builder( GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN).build();
is sufficient for
Games Lite scope
.
Note: This is as per 14th November 2018
来源:https://stackoverflow.com/questions/49656327/google-games-apis-requires-games-lite-function