gpt4 book ai didi

android - 创建 GamesClient 对象

转载 作者:行者123 更新时间:2023-11-30 03:36:33 24 4
gpt4 key购买 nike

我正在尝试将我的游戏与 Google Play 游戏相关联。我的代码:

GamesClient mGamesClient; 
//...
mGamesClient = new GamesClient(null, null, null, null, null, null, 0, null);
Log.i("MyLog", "connecting");
try{
mGamesClient.connect();
Log.i("MyLog", Boolean.toString(mGamesClient.isConnected()));
Log.i("MyLog", mGamesClient.getCurrentAccountName());
}
catch (Exception e){
Log.i("MyLog", e.toString());
}

但它不起作用。

FATAL EXCEPTION: main java.lang.NoClassDefFoundError: com.google.android.gms.games.GamesClient at com.mharezlakmh.myappp.MainActivity.onStart(MainActivity.java:85) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1163) at android.app.Activity.performStart(Activity.java:5018) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2153) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2215) at android.app.ActivityThread.access$600(ActivityThread.java:144) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4936) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558) at dalvik.system.NativeStart.main(Native Method)

怎么了?

我想我应该使用构造器:

mGamesClient = new GamesClient(...);

但是使用文档创建的构造函数不起作用。

最佳答案

您不应该直接构建 GamesClient 对象。相反,使用 GamesClient.Builder 构建它。

GamesClient client = GamesClient.Builder(this, this, this).create();

关于android - 创建 GamesClient 对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16591505/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com