facebook twitter hatena line email

「Unity/GooglePlayGames/ver2」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(Google Play GamesのAndroid Setupの設定)
("Error SignInRequest Sign-in failed with status code: 10"エラーが発生するとき)
行93: 行93:
  
 
apkを上げてなければ、署名付きのapkをupして、アップロード鍵の証明書が表示されるか確認する
 
apkを上げてなければ、署名付きのapkをupして、アップロード鍵の証明書が表示されるか確認する
 +
 +
====PlayGame認証で、DEVELOPER_ERRORが起こるとき====
 +
エラー詳細
 +
<pre>
 +
**** APP NOT CORRECTLY CONFIGURED TO USE GOOGLE PLAY GAME SERVICES
 +
**** DEVELOPER_ERROR
 +
**** This is usually caused by one of these reasons:
 +
**** (1) Your package name and certificate fingerprint do not match
 +
****    the client ID you registered in Developer Console.
 +
**** (2) Your App ID was incorrectly entered.
 +
**** (3) Your game settings have not been published and you are
 +
****    trying to log in with an account that is not listed as
 +
****    a test account.
 +
**** (4) A server auth code was requested, but an incorrect client
 +
****    id was provided. The client id for server auth codes should
 +
****    be the client id for the game server (not the android app).
 +
****
 +
**** To help you debug, here is the information about this app
 +
**** Package name        : com.example.project1
 +
**** Cert SHA1 fingerprint: D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7
 +
**** App ID from manifest : 12345678901
 +
****
 +
**** Check that the above information matches your setup in
 +
**** Developer Console. Also, check that you're logging in with the
 +
**** right account (it should be listed in the Testers section if
 +
**** your project is not yet published).
 +
****
 +
**** For more information, refer to the troubleshooting guide:
 +
****  http://developers.google.com/games/services/android/troubleshooting
 +
****
 +
</pre>
 +
GCPに登録した、ウェブアプリケーションIDと、アプリに登録したものが、同じかどうか確認する。
 +
 +
====PlayGame認証で、"Returning an error code"が起こるとき====
 +
releaseバージョンで認証させたときに、以下エラーコードが起こる場合
 +
<pre>
 +
*** [Play Games Plugin 2.0.0] ERROR: Returning an error code.
 +
</pre>
 +
GCPに登録した、ウェブアプリケーションIDと、アプリに登録したものが、同じかどうか確認する。
 +
 +
releaseバージョンで認証させたときに、上記エラーコードが起こる。debugバージョンだと、多分、DEVELOPER_ERRORのエラーが起こる。
 +
 +
参考:https://discussions.unity.com/t/google-play-games-canceled/938672/10

2025年7月9日 (水) 15:10時点における版

Androidビルドで"mergeDexRelease"エラーが出る

エラー詳細

Execution failed for task ':launcher:mergeDexRelease'.
> Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'.
   > Failed to transform classes.jar (project :unityLibrary) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, com.android.build.api.attributes.AgpVersionAttr=7.1.2, com.android.build.api.attributes.BuildTypeAttr=release, com.android.build.gradle.internal.attributes.VariantAttr=release, dexing-enable-desugaring=true, dexing-is-debuggable=false, dexing-min-sdk=23, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'.
         > No variants of com.google.games:gpgs-plugin-support:2.0.0 match the consumer attributes:
             - com.google.games:gpgs-plugin-support:2.0.0 configuration runtime:
                 - Incompatible because this component declares attribute 'artifactType' with value 'srcaar' and the consumer needed attribute 'artifactType' with value 'android-classes-jar'
                 - Other compatible attributes:
                     - Doesn't say anything about asm-transformed-variant (required 'NONE')
                     - Doesn't say anything about dexing-enable-desugaring (required 'true')
                     - Doesn't say anything about dexing-is-debuggable (required 'false')
                     - Doesn't say anything about dexing-min-sdk (required '24')

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4m 3s

対策

  1. Assets/GooglePlayGames/com.google.play.games/Editor/m2repository/com/google/games/gpgs-plugin-support/2.0.0にある srcaar 拡張子を aar へ
  2. Assets/GooglePlayGames/com.google.play.games/Editor/m2repository/com/google/games/gpgs-plugin-support/2.0.0/gpgs-plugin-support-2.0.0.pom の srcaar を aar へ。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.google.games</groupId>
  <artifactId>gpgs-plugin-support</artifactId>
  <version>2.0.0</version>
-  <packaging>srcaar</packaging>
+  <packaging>aar</packaging>
  <dependencies>
    <dependency>
      <groupId>com.google.android.gms</groupId>
      <artifactId>play-services-games-v2</artifactId>
      <version>20.1.2</version>
    </dependency>
    <dependency>
      <groupId>com.google.android.gms</groupId>
      <artifactId>play-services-nearby</artifactId>
      <version>18.5.0</version>
    </dependency>
  </dependencies>
</project>

参考:https://www.reddit.com/r/Unity3D/comments/1h4szl0/unity_android_update_sdks_to_use_api_34_and_lots/

設定

Google Play GamesのAndroid Setupの設定

公式:https://firebase.google.com/docs/auth/unity/play-games?hl=ja

  1. unityのplatformをAndroidにする。
  2. unityメインメニューから[Window] > [Google Play Games] > [Setup] > [Android Setup] を開き、
  3. Directory to save Constantの項目に、Assets/GooglePlayGamesを入れる
  4. WebAppClientIdの項目に、gcp&play画面で入れた、ウェブアプリケーションのClientIdをいれる。

ProjectSettings/GooglePlayGameSettings.txt に APP_IDが入ることを確認。

ProjectSettings/GooglePlayGameSettings.txt

proj.AppId=12345678901
and.ClientId=12345678901-abcdef1234567890abcdef1234567890ab.apps.googleusercontent.com

unityのGamePlayの初期設定確認

Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/GameInfo.cs

public const string ApplicationId = "12345678901"; // Filled in automatically
public const string IosClientId = "__IOS_CLIENTID__"; // Filled in automatically
public const string WebClientId = "12345678901-abcdef1234567890abcdef1234567890ab.apps.googleusercontent.com"; // Filled in automatically
public const string NearbyConnectionServiceId = "";

上のClientIdなどが入ってることを確認

Assets/Plugins/Android/GooglePlayGamesManifest.androidlib/AndroidManifest.xml にAPP_IDが入ってること。\u003はユニコード用のもので、入っていても問題ない。

<meta-data android:name="com.google.android.gms.games.APP_ID"
            android:value="\u00312345678901" />

<meta-data android:name="com.google.android.gms.games.unityVersion"
            android:value="\u0032.0.0" />

[Window] > [Google Play Games] > [Setup]でAndroidSetupが選択できないとき

  1. unityのplatformをAndroidにする。

"Error SignInRequest Sign-in failed with status code: 10"エラーが発生するとき

PlayConsoleのアップロード鍵の証明書が表示されてるか確認する。

apkを上げてなければ、署名付きのapkをupして、アップロード鍵の証明書が表示されるか確認する

PlayGame認証で、DEVELOPER_ERRORが起こるとき

エラー詳細

**** APP NOT CORRECTLY CONFIGURED TO USE GOOGLE PLAY GAME SERVICES
**** DEVELOPER_ERROR
**** This is usually caused by one of these reasons:
**** (1) Your package name and certificate fingerprint do not match
****     the client ID you registered in Developer Console.
**** (2) Your App ID was incorrectly entered.
**** (3) Your game settings have not been published and you are 
****     trying to log in with an account that is not listed as
****     a test account.
**** (4) A server auth code was requested, but an incorrect client
****     id was provided. The client id for server auth codes should
****     be the client id for the game server (not the android app).
****
**** To help you debug, here is the information about this app
**** Package name         : com.example.project1
**** Cert SHA1 fingerprint: D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7:D7
**** App ID from manifest : 12345678901
****
**** Check that the above information matches your setup in 
**** Developer Console. Also, check that you're logging in with the
**** right account (it should be listed in the Testers section if
**** your project is not yet published).
****
**** For more information, refer to the troubleshooting guide:
****   http://developers.google.com/games/services/android/troubleshooting
****

GCPに登録した、ウェブアプリケーションIDと、アプリに登録したものが、同じかどうか確認する。

PlayGame認証で、"Returning an error code"が起こるとき

releaseバージョンで認証させたときに、以下エラーコードが起こる場合

*** [Play Games Plugin 2.0.0] ERROR: Returning an error code.

GCPに登録した、ウェブアプリケーションIDと、アプリに登録したものが、同じかどうか確認する。

releaseバージョンで認証させたときに、上記エラーコードが起こる。debugバージョンだと、多分、DEVELOPER_ERRORのエラーが起こる。

参考:https://discussions.unity.com/t/google-play-games-canceled/938672/10