【问题标题】:Unity 5.6: Google Play Services and Firebase Messaging plugins not compatibleUnity 5.6:Google Play 服务和 Firebase 消息插件不兼容
【发布时间】:2017-09-20 14:01:28
【问题描述】:

在安装 Google Play 服务插件和 Firebase 消息插件后,我无法进行构建。我正在使用两者的最新版本。我收到“无法将类转换为 dex 格式”错误。冲突的两个库是 play-services-auth-10.2.6 和 play-services-base-11.2.0。 Google Play 服务解析器为我抓取了这两个库。谁有解决办法?

【问题讨论】:

  • 我建议只使用一个版本,比如 10.2.6 版本或 11.2.0,不要混合使用。关于你的错误,一些论坛说这可能与重复的 jars 有关,你应该删除它们,以便只使用一个副本。检查这个SO post
  • 发布你的错误和 build.gradle
  • 错误最终是这样的:com.android.dex.DexException: Multiple dex files defined Lcom/google/android/gms/auth/api/signin/internal/zzf;

标签: firebase unity3d google-play-services firebase-cloud-messaging


【解决方案1】:

我一直在搞乱谷歌播放服务插件中的 GPGSDependencies.xml 和 PluginVersion.cs 文件。我试图使库版本相同。

我确实设法获得了相同的库版本,这确实解决了 DEX 格式问题,但是当我调用验证 google 帐户时,我的应用程序崩溃了。

这就是我所做的: 在 GPGSDependencies.xml 中,我将这些行中的 10+ 更改为 11.1+

<androidPackage spec="com.google.android.gms:play-services-games:10+">
...
<androidPackage spec="com.google.android.gms:play-services-nearby:10+">
...
<androidPackage spec="com.google.android.gms:play-services-auth:10+">

我还将 PluginVersion.cs 中的行更改为

// used to check for the correct min version or play services: 11.2
public const int MinGmsCoreVersionCode = 11200000;

// used to get the right version of dependencies.
public const string PlayServicesVersionConstraint = "11.1+";

来自

// used to check for the correct min version or play services: 10.2
public const int MinGmsCoreVersionCode = 10200000;

// used to get the right version of dependencies.
public const string PlayServicesVersionConstraint = "10+";

这里提到了 PluginVersion.cs 更改: https://github.com/playgameservices/play-games-plugin-for-unity/issues/1892#issuecomment-325555313.

这并没有解决我所有的问题,但也许它会帮助你。

如果你设法解决了,请告诉我,我仍在研究解决方案。

【讨论】:

【解决方案2】:

我让它与最新的谷歌播放服务解析器一起工作。

https://github.com/googlesamples/unity-jar-resolver

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-20
    • 1970-01-01
    • 2014-12-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多