2

ネイティブエミュレータでGoogle Playゲームサービスに接続できませんが、同じapkがBluestacksで動作します。Google Playゲームサービス+エミュレータ

これまでのところ、アプリはGames.Achievements.getAchievementsIntentでユーザーの業績のリストをリクエストしています。これらの成果はBluestacksで正常に表示されますが、ネイティブエミュレータの画面は空白のままです。

私がプレゼンテーションロジックを実装していなかったため、Bluestacksがユーザーの業績を表示したのは驚きでした。

app running in Bluestacks

私はグーグルとの依存関係を構築しています再生するサービス9.6.1:

compile 'com.google.android.gms:play-services-games:9.6.1' 
エミュレータは、私がautomanagedインスタンスを使用していますAPIと24 +のGoogle API

をシステムイメージを実行している

接続しようとするが失敗するGoogleApiClientの私は無用に多くの修正を試みました。

@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 {[email protected]} 

        [ 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: [email protected]}, message=null} 
D/onActivityResult: resultCode = 0 

答えて

0

私はこれが役立つかはわからないが、私はそれが言うことをあなたのエラーログに気づい:

"You have not specified a View to use as content view for popups." 

チェックこのSO thread提案:

setViewForPopUpsメソッド

Games.setViewForPopups(getApiClient(), getWindow().getDecorView().findViewById(android.R.id.content)); 

これを行うための別の方法はあるに:

あなたmGoogleApiClientオブジェクトでsetViewForPopupsを定義します。

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(); 

コードを見ると、これを追加していないようです。追加の読書はsetViewForPopups methodです。

関連する問題