【发布时间】:2017-12-01 13:11:07
【问题描述】:
大家好。
我正在尝试在我正在开发的游戏中实现成就。
我已经在 google play 控制台上设置了所有内容,获取了 app-id,将以下内容放入清单中
<meta-data
android:name="com.google.android.gms.games.APP_ID"
android:value="@string/app_id" />
并写了如下方法
GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
int temp = googleApiAvailability.isGooglePlayServicesAvailable(this);
if ( temp != 0)
return;
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN)
.requestEmail()
.build();
GoogleSignIn.getClient(this, gso);
GoogleSignInAccount account = GoogleSignIn.getLastSignedInAccount(this);
PlayersClient player = Games.getPlayersClient(this, account);
当我运行它时,我得到了我的帐户,但当它运行 Games.getPlayersClient(this, account); 时,我收到以下错误:
java.lang.IllegalStateException:游戏 API 需要 https://www.googleapis.com/auth/games_lite函数。
任何人都知道可能出了什么问题吗?
提前致谢。
【问题讨论】:
-
这与 Unity 有关吗?如果是,那么您可以检查此github forum。
-
嗨@noogui。没有。它与 Unity 无关。
-
请注意,requestEmail() 将阻止自动登录发生,用户需要查看登录 UI。
标签: java android google-play google-play-games illegalstateexception