Android 谷歌游戏服务&x2B;仿真器

Android 谷歌游戏服务&x2B;仿真器,android,google-play-services,google-play-games,bluestacks,Android,Google Play Services,Google Play Games,Bluestacks,我无法在本机仿真器中连接到Google Play Game服务,但是,相同的apk在Bluestack中工作 到目前为止,该应用程序通过请求用户的成就列表。这些成就成功地显示在Bluestack中,但是,本机emulator屏幕仍为空白 老实说,当Bluestack显示用户的成就(如下所示)时,我感到惊讶,因为我没有实现任何表示逻辑 我正在使用Google Play Services 9.6.1建立依赖关系: compile 'com.google.android.gms:play-servi

我无法在本机仿真器中连接到Google Play Game服务,但是,相同的apk在Bluestack中工作

到目前为止,该应用程序通过请求用户的成就列表。这些成就成功地显示在Bluestack中,但是,本机emulator屏幕仍为空白

老实说,当Bluestack显示用户的成就(如下所示)时,我感到惊讶,因为我没有实现任何表示逻辑

我正在使用Google Play Services 9.6.1建立依赖关系:

compile 'com.google.android.gms:play-services-games:9.6.1'
Emulator正在运行带有API 24+Google API的系统映像

我正在使用GoogleAppClient的一个自动托管实例,该实例尝试连接,但随后失败。我尝试了许多修复方法,但都没有效果

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

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

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    Log.d("onActivityResult", "resultCode = " + resultCode);
    if (resultCode == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED) {
        mGoogleApiClient.connect();
    }
}

@Override
public void onConnected(@Nullable Bundle bundle) {
    Log.d("onConnected", "onConnected");
    startActivityForResult(Games.Achievements.getAchievementsIntent(mGoogleApiClient), MY_REQ_CODE);
}

@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
    Log.d("onConnectionFailed", "onConnectionFailed");
    mGoogleApiClient.connect();
}
结果显示Android监视器:

    Connected to process 7907 on device Nexus_5X_API_24_GApps [emulator-5554]
W/System: ClassLoader referenced unknown path: /data/app/goc.dma.cprach.gameofchairs-1/lib/x86
W/PopupManager: You have not specified a View to use as content view for popups. Falling back to the Activity content view. Note that this may not work as expected in multi-screen environments
D/AutoManageHelper: starting AutoManage for client 0 false false
D/onStart: onStart
D/AutoManageHelper: onStart true {0=com.google.android.gms.internal.zzqa$zza@e9fa141}

                    [ 10-20 03:00:11.990  1490: 1511 D/         ]
                    HostConnection::get() New Host Connection established 0x8c3f9680, tid 1511
W/gralloc_ranchu: Gralloc pipe failed

                  [ 10-20 03:00:12.089  7907: 7907 D/         ]
                  HostConnection::get() New Host Connection established 0xa438dac0, tid 7907
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
D/onConnectionFailed: onConnectionFailed
D/AutoManageHelper: beginFailureResolution for ConnectionResult{statusCode=RESOLUTION_REQUIRED, resolution=PendingIntent{20c0bc3: android.os.BinderProxy@6889c40}, message=null}
D/onActivityResult: resultCode = 0

我不确定这是否有帮助,但我注意到您的错误日志中显示:

"You have not specified a View to use as content view for popups."
检查此项,这表明:

使用setViewForPopUps方法

 Games.setViewForPopups(getApiClient(), getWindow().getDecorView().findViewById(android.R.id.content));
另一种方法是:

在mGoogleApiClient对象中定义setview for弹出窗口。

mGoogleApiClient = new GoogleApiClient.Builder(getApplicationContext())
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(Plus.API).addScope(Plus.SCOPE_PLUS_LOGIN)
            .addApi(Games.API).addScope(Games.SCOPE_GAMES)
            .addApi(Drive.API).addScope(Drive.SCOPE_APPFOLDER)
            .setViewForPopups(findViewById(android.R.id.content))
            .build();
看看你的代码,似乎你还没有添加这个。下面是关于这个问题的补充说明