본문 바로가기

개발이야기/Android

구글 게임 플레이 서비스 디버깅 방법



구글 게임 플레이 서비스 디버깅

Google Play Game Service(이하 GPGS)를 디버깅하다보면 나오는 무시무시한 에러가 있다.

failed to sign in. please check your network connection and try again

만약 이 글을 읽는 개발자가 GPGS의 Document에 따라서 잘 개발했다면(혹은 GPGS sample app을 다운받아서 디버깅할때) 마지막 남은 관문을 넘지 못해서 나오는 오류인 것이다. 

GPGS는 디버깅시에 signed apk를 사용하여 디버깅해야만 한다.


GPGS 디버깅 방법

GPGS와 사용자의 google 계정 연결 혹은 업적과 같은 기능의 테스트를 위해서는 일반적인 Android studio의 RUN으로는 불가능하다. 해당 내용은 GPGS 공식홈페이지에도 아래와 같이 나와있다.

  1. Choose Installed application as your Application type and select Android as the installed application type (these should be your only options).
  2. In the Package name field, enter your Android application's package name.
  3. Open a terminal and run the Keytool utility to get the SHA1 fingerprint of the certificate. You should get both the release and debug certificate fingerprints.

    To get the release certificate fingerprint:

    keytool -list -keystore <path-to-production-keystore>
    To get the debug certificate fingerprint:
    keytool -list -keystore <path-to-debug-keystore>
  4. The keytool prompts you to enter a password for the keystore. The default password for the debug keystore is android. The keytool then prints the fingerprint to the terminal.
  5. Paste the SHA1 fingerprint into the Signing certificate fingerprint (SHA1) field.
  6. Click the Create client button, then follow the steps in the Gather credentials for authentication and authorization section below.

For more information about OAuth 2.0 on Android, see Authenticating to OAuth2 Services.

You should create two client IDs, one with the release certificate fingerprint and another with the debug certificate fingerprint. Make sure to use the same package name for both. This allows Google Play games services to recognize calls from your linked APKs that are signed with either certificate. For more information about certificate signing for Android, see Signing Your Application.

You can add more than one Android app to the same game entry in Google Play Console. However, this should only be done if there are different versions of the same game (for example, the free version and the paid version). In this case, always list the paid version before the free version (or the full version before the demo/trial version). Do not link different games to the same project as this may cause incorrect behavior. Instead, create a separate game entry in the Google Play Console for each game that you publish. 

출처 : https://developers.google.com/games/services/console/enabling


GPGS디버깅 절차

※ 기본적인 Google play console에 게임 서비스를 등록하고 app_id 등을 등록하는 과정은 생략


Build > Generated Signed APK 선택

Next 선택

keystore선택, 비밀호 입력(없다면 keystore을 생성), Next선택



V1, V2를 모두선택, Finish 선택


Generated Signed APK success되었는지 확인

adb를 실행시킬 수 있는 path로 가서, 생성한 apk를 mobile phone에 설치
(./adb install apk위치)



정상적으로 설치되었고 디버깅 되는 것을 볼 수 있다.


End of Documents