使用 Google Play 服务插件构建失败。找不到 com.google.games:gpgs-plugin-support:0.11.01

问题描述 投票:0回答:2

我正在尝试为 Android 构建我的应用程序。我目前安装了 Google AdMob 软件包以及 Google Play 服务插件,但是无法使用 google play 服务软件包进行构建。

> 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

我已经正确设置了位置

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>

我已经进行了多次强制解析,我更改了 JAVA_HOME 环境变量。我完全不知道是什么导致了这个问题,我怀疑这与 admob 包和 Google Play 服务冲突有关。

这也是我的

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**
c# android unity-game-engine admob google-play-services
2个回答
0
投票

1)下载两个包:https://github.com/playgameservices/play-games-plugin-for-unity/blob/master/current-build/GooglePlayGamesPlugin-0.11.01.unitypackagehttps:// github.com/google/play-unity-plugins/releases/download/v1.8.0/com.google.play.appupdate-1.8.0.unitypackage.

  1. 使用Unity 2020.3.30f1创建一个新的2D项目

  2. 切换平台至Android

  3. 使用 Assets/Import package/Custom package/GooglePlayGamesPlugin-0.11.01.unitypackage 导入 GooglePlayGamesPlugin-0.11.01.unitypackage

  4. 出现自动分辨率弹出窗口:启用

  5. 出现“解决 Android 依赖关系”:100% 已解决

  6. 通过查看 Windows/Google Play 游戏来检查是否安装了插件

  7. 导入com.google.play.appupdate-1.8.0.unitypackage

  8. 出现“正在解决 Android 依赖关系”:库处理完成

  9. 出现错误:解析失败并出现另一个弹出窗口:Google 版本处理程序:您要删除过时的 EDM 1.2.169 吗? --> 申请 您可以无限重复 9-10 强制解析 Assets/ EDM/Android Resolver/Force resolve


0
投票

来源:https://www.youtube.com/watch?v=a8ynwRd8Uxc

  1. 打开文件:Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependency.xml

  2. 找到以下行

Packages/com.google.play.games/Editor/m2repository

  1. 将其替换为:

资产/GooglePlayGames/com.google.play.games/Editor/m2repository

  1. 保存并关闭文件
  2. 在 Unity 上,单击菜单 Assets -> External Dependency Manager -> Android Resolver -> Force Resolve
  3. 举起双手并赞美全能的上帝,你就完成了。
© www.soinside.com 2019 - 2024. All rights reserved.