久々にAndroidビルドしたら `Execution failed for task ':launcher:mapDebugSourceSetPaths'.`

Gradleでこんな感じのエラー出た時の対処法。

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':launcher:mapDebugSourceSetPaths'.
> Could not resolve all files for configuration ':launcher:debugRuntimeClasspath'.
   > Could not resolve all dependencies for configuration ':launcher:debugRuntimeClasspath'.
      > Could not find com.google.games:gpgs-plugin-support:0.11.01.
        Searched in the following locations:
          - https://dl.google.com/dl/android/maven2/com/google/games/gpgs-plugin-support/0.11.01/gpgs-plugin-support-0.11.01.pom
          - https://repo.maven.apache.org/maven2/com/google/games/gpgs-plugin-support/0.11.01/gpgs-plugin-support-0.11.01.pom
          - file:/Users/**/Unity/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/gpgs-plugin-support-0.11.01.jar
          - file:/Users/**/Unity/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/gpgs-plugin-support.jar
        Required by:
            project :launcher > project :unityLibrary
  • 何はともあれcom.google.*のパッケージを更新する。com.google.external-dependency-managerとかcom.google.play.coreとか。

  • それだけで満足せずにplay-games-plugin-for-unityも更新する。

  • Assets > External Dependency Manager > Android Resolver > Force Resolve

  • この辺りで一回Library以下消して再起動した方が安全。なぜか通らないな〜と思って消したら通るようになった。

  • 手動でビルドかけてみると、mainTemplate.gradleが古いから更新しても良い?とか聞いてくるので更新してもらう。これにより新たなエラーが出ることもある。(CIに任せっきりにしていたらこれが出なくて困ってた。)