You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

集成Google Play Services插件构建失败:找不到gpgs-plugin-support:0.11.01

Android构建失败:找不到com.google.games:gpgs-plugin-support:0.11.01

我正在构建Android应用,已安装Google AdMob包与Google Play Services插件,但后者导致构建失败,提示无法找到com.google.games:gpgs-plugin-support:0.11.01。已正确配置依赖文件路径,多次执行强制解析操作,修改过JAVA_HOME环境变量,但问题仍未解决,怀疑AdMob与Google Play Services存在冲突。

错误日志

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

相关配置文件内容

1. 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>

2. Assets/Plugins/Android/mainTemplate.gradle

// Android Resolver Repos Start
([rootProject] + (rootProject.subprojects as List)).each { project ->
    project.repositories {
        def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\", "/")
        maven {
            url "https://maven.google.com"
        }
        maven {
            url "https://maven.google.com/" // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:7, Assets/GoogleMobileAds/Editor/GoogleUmpDependencies.xml:7
        }
        maven {
            url (unityProjectPath + "/Assets/GooglePlayGames/com.google.play.games/Editor/m2repository") // Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml:11
        }
        mavenLocal()
        jcenter()
        mavenCentral()
    }
}
// Android Resolver Repos End
apply plugin: 'com.android.library'
**APPLY_PLUGINS**

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
// Android Resolver Dependencies Start
    implementation 'com.google.android.gms:play-services-ads:22.5.0' // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:7
    implementation 'com.google.android.ump:user-messaging-platform:2.1.0' // Assets/GoogleMobileAds/Editor/GoogleUmpDependencies.xml:7
    implementation 'com.google.games:gpgs-plugin-support:0.11.01' // Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml:11
// Android Resolver Dependencies End
**DEPS**}

// Android Resolver Exclusions Start
android {
  packagingOptions {
      exclude ('/lib/armeabi/*' + '*')
      exclude ('/lib/armeabi-v7a/*' + '*')
      exclude ('/lib/mips/*' + '*')
      exclude ('/lib/mips64/*' + '*')
      exclude ('/lib/x86/*' + '*')
      exclude ('/lib/x86_64/*' + '*')
  }
}
// Android Resolver Exclusions End
android {
    ndkPath "**NDKPATH**"

    compileSdkVersion **APIVERSION**
    buildToolsVersion '**BUILDTOOLS**'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }

    defaultConfig {
        minSdkVersion **MINSDKVERSION**
        targetSdkVersion **TARGETSDKVERSION**
        ndk {
            abiFilters **ABIFILTERS**
        }
        versionCode **VERSIONCODE**
        versionName '**VERSIONNAME**'
        consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
        ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
    }**PACKAGING_OPTIONS**
}
**IL_CPP_BUILD_SETUP**
**SOURCE_BUILD_SETUP**
**EXTERNAL_SOURCES**

解决方法

  • 检查本地依赖文件完整性:确认Assets/GooglePlayGames/com.google.play.games/Editor/m2repository/com/google/games/gpgs-plugin-support/0.11.01目录下存在.pom和.jar文件,若缺失则重新下载完整的Google Play Services插件,或手动补充该依赖包。

  • 修复Gradle本地仓库路径:将mainTemplate.gradle中本地maven仓库的URL改为绝对路径格式,避免路径拼接错误:

    maven {
        url uri("${project.rootDir}/Assets/GooglePlayGames/com.google.play.games/Editor/m2repository")
    }
    
  • 统一Google服务版本:AdMob的play-services-ads:22.5.0与GPGS依赖可能存在版本不兼容,尝试升级Google Play Services插件到最新稳定版,或调整AdMob版本与GPGS依赖的Google服务版本对齐。

  • 清理缓存并重新解析:删除Unity的Library/Bee和Library/Android目录,执行Assets > External Dependency Manager > Android Resolver > Force Resolve,重启Unity后重新构建。

  • 移除重复仓库配置:删除mainTemplate.gradle中重复的https://maven.google.com仓库配置,保留一个即可避免仓库优先级冲突。

内容的提问来源于stack exchange,提问作者Cheese010

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.04 15:02:17