Unity/GooglePlayGames/ver2
提供: 初心者エンジニアの簡易メモ
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
対策
- Assets/GooglePlayGames/com.google.play.games/Editor/m2repository/com/google/games/gpgs-plugin-support/2.0.0にある srcaar 拡張子を aar へ
- 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 へ。
参考: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
- unityのplatformをAndroidにする。
- unityメインメニューから[Window] > [Google Play Games] > [Setup] > [Android Setup] を開き、
- Directory to save Constantに、Assets/GooglePlayGamesを入れる
- WebAppClientIdに、上の項目で入れた、ウェブアプリケーションのClientIdをいれる。
Assets/GooglePlayGames/Plugins/Android/GooglePlayGamesManifest.plugin/AndroidManifest.xml に APP_IDが入ることを確認。
unityのGamePlayの初期設定確認
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/GameInfo.cs
public const string ApplicationId = ""; // Filled in automatically public const string IosClientId = "__IOS_CLIENTID__"; // Filled in automatically public const string WebClientId = ""; // Filled in automatically public const string NearbyConnectionServiceId = "";
上のClientIdなどが入ってることを確認
[Window] > [Google Play Games] > [Setup]でAndroidSetupが選択できないとき
- 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して、アップロード鍵の証明書が表示されるか確認する
