Build failing with Google Play Services Plugin. Could not find com.google.games:gpgs-plugin-support:0.11.01

I am trying to build my app for android. I currently have the Google AdMob package installed as well as the Google Play Services plugin however it is failing to build with the google play services package.

> 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:UNITY_PROJECT/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/gpgs-plugin-support-0.11.01.jar
       - file:UNITY_PROJECT/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/gpgs-plugin-support.jar

I already have the location set correctly in

Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml

<?xml version="1.0" encoding="UTF-8" ?>
<dependencies>
<!-- Internal library dependency generated at build time. 
    It also defines the transitive dependencies on play-services
-->
  <androidPackages>
    <androidPackage spec="com.google.games:gpgs-plugin-support:0.11.01">
      <repositories>
        <repository>Assets/GooglePlayGames/com.google.play.games/Editor/m2repository</repository>
      </repositories>
    </androidPackage>
  </androidPackages>
</dependencies>

I have done multiple force resolves, I have changed the JAVA_HOME environment variable. I am at a complete loss as to what is causing this issue and I suspect it’s something to do with the admob package and Google Play Services conflicting.

3 Likes

Same problem unfortunately

–

6 Answers

6

I was having exactly the same problem with GooglePlayGames & GoogleSignIn. Here’s how I solved it:

Unity version: 2022.3
Scripting backend: IL2CPP
Build type: App Bundle

First, make sure you’ve done the other things in correct order:

  1. Enable Custom Main Gradle Template, Custom Gradle Properties Template & Custom Gradle Settings Template

  2. Force Resolve Libraries using Android Dependency Manager

  3. Restart Unity once (optional)

  4. Check <repository> path in Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml
    Make sure its Assets/GooglePlayGames/com.google.play.games/Editor/m2repository and not Library/GooglePlayGames/com.google.play.games/Editor/m2repository

  5. Open gradleTemplate.properties and make sure you see these lines:

android.useAndroidX=true
android.enableJetifier=true

If not, then add them manually.

The actual solution steps:

  1. Open mainTemplate.gradle and find two separate lines:
    def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
    and
    url (unityProjectPath + "/Assets/GeneratedLocalRepo/GoogleSignIn/Editor/m2repository") inside a maven block. In your case it should be GooglePlayGames.

  2. Open settingsTemplate.gradle, paste the above lines together inside dependencyResolutionManagement → repositories

It should look like:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
    repositories {
        def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
        maven {
            url (unityProjectPath + "/Assets/GeneratedLocalRepo/GoogleSignIn/Editor/m2repository") // Assets/GoogleSignIn/Editor/GoogleSignInSupportDependencies.xml:9
        }
        **ARTIFACTORYREPOSITORY**
        google()
        mavenCentral()
        flatDir {
            dirs "${project(':unityLibrary').projectDir}/libs"
        }
    }
}

In your case again, it should be GooglePlayGames, not GoogleSignIn.

That should be it! Probably not the best solution, just a way to successfully get past gradle build for now.

Thank you so much! The settingsTemplate.gradle was the issue, added that file with the repository and it works!

–

This worked for me too :+1:

–

This almost worked - but I had to copy other maven commands from mainTemplate.gradle to get it to build (I had an IronSource repository that wasn't found after the google issue was solved).

–

That worked perfectly! Appericate that! Been searching for this fix for 8 hours now! :handshake:

–

Too complicated. Here try this
Source: https://www.youtube.com/watch?v=a8ynwRd8Uxc

  1. Open file: Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml

  2. Find the following line

<repository>Packages/com.google.play.games/Editor/m2repository</repository>

  1. Replace it with:

<repository>Assets/GooglePlayGames/com.google.play.games/Editor/m2repository</repository>

  1. Save and close file
  2. On Unity, click menu Assets → External Dependency Manager → Android Resolver → Force Resolve
  3. Lift your hands up into the air and praise God Almighty, you’re done.

Hi !
I have exactly the same problem, despite the procedures followed to the letter I still get the error message. I created a new project in doubt, there is no other package that could harm the build.

If I comment out the implement line in the mainTemplate I can build without problem.

This is the error message :
FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • What went wrong:
    Execution failed for task ‘:launcher:checkReleaseDuplicateClasses’.

Could not resolve all dependencies for configuration ‘:launcher:releaseRuntimeClasspath’.
The project declares repositories, effectively ignoring the repositories you have declared in the settings.
You can figure out how project repositories are declared by configuring your build to fail on project repositories.
See Declaring repositories for details.
Could not find com.google.games:gpgs-plugin-support:0.11.01.
Searched in the following locations:
- file:/H:/Test_Google_Login/Assets/GeneratedLocalRepo/GooglePlayGames/Editor/m2repository/com/google/games/gpgs-plugin-support/0.11.01/gpgs-plugin-support-0.11.01.pom
- .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:/H:/Test_Google_Login/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/gpgs-plugin-support-0.11.01.jar
- file:/H:/Test_Google_Login/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/gpgs-plugin-support.jar
Required by:
project :launcher > project :unityLibrary

Do you have some other idea ? Thank a lot

Using Unity 2022.3.6f1

It seems that I found the solution, I just had to keep these lines in the settingTemplate: pluginManagement { repositories { ARTIFACTORYREPOSITORY gradlePluginPortal() google() mavenCentral() } } include ':launcher', ':unityLibrary' INCLUDES

–

Hi.
I had a similar problem.

FAILURE: Build failed with an exception. 
* What went wrong: [error] 
 Execution failed for task ':launcher:mergeDexRelease'. 
  > Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'. 
   > Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'. 
    > No variants of com.google.games:gpgs-plugin-support:2.1.0 match the consumer attributes: 
     - com.google.games:gpgs-plugin-support:2.1.0 configuration runtime declares a library for use during runtime: 
      - Incompatible because this component declares a component, as well as attribute 'artifactType' with value 'srcaar' and the consumer needed a component, as well as attribute 'artifactType' with value 'android-classes-jar' 
       - Other compatible attributes: 
        - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.7.2') 
         - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release') 
          - Doesn't say anything about its target Java environment (preferred optimized for Android) 
           - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')

I think I have found a solution to this problem.

  1. Unity 6000.0.54
  2. Install GooglePlayGamesPlugin-2.1.0.unitypackage - manual Google Play Games
  3. Edit Assets\GooglePlayGames\com.google.play.games\Editor\GooglePlayGamesPluginDependencies.xml file
<?xml version="1.0" encoding="UTF-8" ?>
<dependencies>
<!-- Internal library dependency generated at build time. 
    It also defines the transitive dependencies on play-services
-->
  <androidPackages>
    <androidPackage spec="com.google.games:gpgs-plugin-support:2.1.0@aar">
      <repositories>
        <repository>Assets/GeneratedLocalRepo/GooglePlayGames/com.google.play.games/Editor/m2repository</repository>
      </repositories>
    </androidPackage>
  </androidPackages>
</dependencies>

Here the package format is changed to aar and the path to Assets/GeneratedLocalRepo/GooglePlayGames/com.google.play.games/Editor/m2repository is added.
4. Assets → External Dependency Manager → Android Resolver → Force Resolve
A folder called GeneratedLocalRepo will be created, inside of which there will be gpgs-plugin-support-2.1.0.aar
5. Clean build

The solution is similar to the solution above from @ttran07

I had the same error a while ago. The problem was that I first installed the package through Git and then locally, because I thought the .unitypackage file no longer existed (but it actually is inside the current-build folder). When I imported it using the .unitypackage, those errors went away.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:unityLibrary:compileReleaseJavaWithJavac’.

Could not resolve all files for configuration ‘:unityLibrary:releaseCompileClasspath’.
Could not resolve all dependencies for configuration ‘:unityLibrary:releaseCompileClasspath’.
Could not find com.google.games:gpgs-plugin-support:2.1.0.
Required by:
project :unityLibrary
helpppp