Android Virtual Machine: Double Error: "Google Play Games not installed"

Android Virtual Machine: Double Error: "Google Play Games not installed"

我正在创建游戏并尝试实现 Google Play 游戏登录。 我的问题是(我认为是)Google Play Games 没有正确安装在 VM 上。如果我启动应用程序,它会给我 "Google Play Games isn't installed" 的响应(见图片)。如果您单击“安装”或“取消”按钮,它将再次打开同一屏幕。我不知道为什么。没有错误显示。

Link to the Error Image

这是连接到登录系统的全部代码:

@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
    Log.d(TAG, "Connection Failed");

    if (mResolvingConnectionFailure) {
        // Already resolving
        return;
    }

    // If the sign in button was clicked or if auto sign-in is enabled,
    // launch the sign-in flow
    if (mSignInClicked || mAutoStartSignInFlow) {
        mAutoStartSignInFlow = false;
        mSignInClicked = false;
        mResolvingConnectionFailure = true;

        // Attempt to resolve the connection failure using BaseGameUtils.
        // The R.string.signin_other_error value should reference a generic
        // error string in your strings.xml file, such as "There was
        // an issue with sign in, please try again later."
    if (!BaseGameUtils.resolveConnectionFailure(this,
                mGoogleApiClient, connectionResult,
                RC_SIGN_IN, getResources().getString(R.string.signin_other_error))) {
            mResolvingConnectionFailure = false;
        }
    }

    // Put code here to display the sign-in button
}

public void onGoogleClick(View view){
    mSignInClicked = true;
    mGoogleApiClient.connect();
}

@Override
public void onConnected(Bundle connectionHint) {
    // show sign-out button, hide the sign-in button
    findViewById(R.id.sign_in_button).setVisibility(View.GONE);
    Log.d(TAG, "Connected");
    Games.Achievements.unlock(mGoogleApiClient, getResources().getString(R.string.ach_lvl3));

    // (your code here: update UI, enable functionality that depends on sign in, etc)
}

@Override
public void onConnectionSuspended(int i) {
    Log.d(TAG, "Connection Suspended");
}

以及 GoogleApiClient 声明

    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .enableAutoManage(this, this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(Games.API).addScope(Games.SCOPE_GAMES)
            .build();

查看 Google Page on the topic

简短版本:

  • 确保 Google API 已在 AVD 管理器中更新
  • 为 AVD 选择 "Google APIs x86 version NN"(NN 是您的目标)。

前段时间为我修复了地图 - 还有一些其他小问题。问题是不是每个图像都安装了 Play store and/or 特定的 Goog API,所以它们失败了。使用 Google API 可以确定两者都存在。

HTH

好吧,结合其他想法。

  1. 在 "Android SDK Manager" 中重新安装 Google API(在 extras 下列出)。我不希望这能解决你的问题,只是覆盖基础。
  2. 我从未尝试过,但很多知识渊博的人推荐 Genymotion 作为调试的替代方案 - 虽然最近听起来 Play 服务已从他们的 AVD 中删除,但 says 他们仍然支持 play .

希望你能尽快开始。

根据所附图片,Google Play 服务应用程序可能已过时。您只需要更新应用即可。

转到 Google 播放并下载 Google Play services。希望对您有所帮助。