gpt4 book ai didi

Android - Google Play 服务、游戏客户端、运行时错误

转载 作者:行者123 更新时间:2023-11-29 17:51:04 26 4
gpt4 key购买 nike

我已经检查了几个不同的问题,例如 this

我正在尝试实现 Google 登录并引用了 https://developers.google.com/games/services/training/signin/但无法弄清楚如何解决此错误

我的 list 文件中目前有以下元数据

      <meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="@string/app_id" />
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>

我的 LogCat 错误如下所示:

- 04-01 15:25:28.461: E/AndroidRuntime(30017): FATAL EXCEPTION: main
- 04-01 15:25:28.461: E/AndroidRuntime(30017): java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
- 04-01 15:25:28.461: E/AndroidRuntime(30017): at com.google.android.gms.internal.eh$h.b(Unknown Source)
- 04-01 15:25:28.461: E/AndroidRuntime(30017): at com.google.android.gms.internal.eh$h.a(Unknown Source)
- 04-01 15:25:28.461: E/AndroidRuntime(30017): at com.google.android.gms.internal.eh$b.ec(Unknown Source)
- 04-01 15:25:28.461: E/AndroidRuntime(30017): at com.google.android.gms.internal.eh$a.handleMessage(Unknown Source)
- 04-01 15:25:28.461: E/AndroidRuntime(30017): at android.os.Handler.dispatchMessage(Handler.java:99)
- 04-01 15:25:28.461: E/AndroidRuntime(30017): at android.os.Looper.loop(Looper.java:137)
- 04-01 15:25:28.461: E/AndroidRuntime(30017): at android.app.ActivityThread.main(ActivityThread.java:5419)
- 04-01 15:25:28.461: E/AndroidRuntime(30017): at java.lang.reflect.Method.invokeNative(Native Method)
- 04-01 15:25:28.461: E/AndroidRuntime(30017): at java.lang.reflect.Method.invoke(Method.java:525)
- 04-01 15:25:28.461: E/AndroidRuntime(30017): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
- 04-01 15:25:28.461: E/AndroidRuntime(30017): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
- 04-01 15:25:28.461: E/AndroidRuntime(30017): at dalvik.system.NativeStart.main(Native Method)

我之前也收到警告:

- 04-01 15:45:45.408: W/PopupManager(1075): You have not specified a View to use as content view for popups. Falling back to the Activity content view which may not work properly in future versions of the API. Use setViewForPopups() to set your content view.

我不确定这是否与它有任何关系我已经尝试覆盖并调用 onCreate()

setViewForPopups()

但是eclipse没有显示这个方法存在。

我当前的 MainActivity 看起来像

public class MainActivity extends BaseGameActivity implements OnClickListener {

boolean mExplicitSignOut = false;
boolean mInSignInFlow = false;

GoogleApiClient mClient;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

GameView gameView = (GameView) findViewById(R.id.game);

GoogleApiClient.Builder builder =
new GoogleApiClient.Builder(this);
builder.addApi(Games.API)
.addApi(Plus.API)
.addApi(AppStateManager.API)
.addScope(Games.SCOPE_GAMES)
.addScope(Plus.SCOPE_PLUS_LOGIN)
.addScope(AppStateManager.SCOPE_APP_STATE);
mClient = builder.build();

}

@Override
protected void onStart() {
super.onStart();
if (!mInSignInFlow && !mExplicitSignOut) {
// auto sign in
mClient.connect();
}
}

@Override
public void onSignInFailed() {
// TODO SignInFailed
Toast.makeText(this, "Sign in Failed", Toast.LENGTH_LONG).show();

}

@Override
public void onSignInSucceeded() {
// TODO SignInSucceeded
Toast.makeText(this, "Sign in Succeeded", Toast.LENGTH_LONG).show();

}

@Override
public void onClick(View v) {
// TODO onClick
Toast.makeText(this, "Clicked", Toast.LENGTH_LONG).show();

}
}

最佳答案

确保 list 文件中包含所有 3 个元数据标签 -

 <meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="@string/app_id" />

<meta-data android:name="com.google.android.gms.appstate.APP_ID"
android:value="@string/app_id" />

<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>

关于Android - Google Play 服务、游戏客户端、运行时错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22795679/

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