facebook twitter hatena line email

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

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(unityのGamePlayの初期設定確認)
(unityのGamePlayの初期設定確認)
行71: 行71:
 
</pre>
 
</pre>
 
上のClientIdなどが入ってることを確認
 
上のClientIdなどが入ってることを確認
 +
 +
Assets/Plugins/Android/GooglePlayGamesManifest.androidlib/AndroidManifest.xml
 +
にAPP_IDが入ってること。\u003はユニコード用のもので、入っていても問題ない。
 +
<pre>
 +
<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" />
 +
</pre>
  
 
====[Window] > [Google Play Games] > [Setup]でAndroidSetupが選択できないとき====
 
====[Window] > [Google Play Games] > [Setup]でAndroidSetupが選択できないとき====

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

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に、上の項目で入れた、ウェブアプリケーションのClientIdをいれる。

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

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にする。

AndroidSetup実行中に"Android SDK Not found"エラーが発生したとき

Android SDK Not found
The Android SDK path was not found. Please configure it in the Unity preferences window (under External Tools).

UnityメインメニューのUnity/Settings/ExternalTools/AndroidSDKのrecommendチェックを外して、同じpathを欄に入れると、表示されなくなった。

androidビルドしたときに"Google Play Games not configured!"以下エラー

エラー詳細

Google Play Games not configured!
Warning!! Google Play Games was not configured, Game Services will not work correctly.

AndroidSetupがうまくいってないので、↑の項目を確認する。

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

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

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