0

安裝Google Play服務插件和Firebase消息傳遞插件後,我無法進行構建。我正在使用兩者的最新版本。我得到「無法將類轉換爲dex格式」錯誤。衝突的兩個庫是play-services-auth-10.2.6和play-services-base-11.2.0。 Google Play服務解析器爲我抓取這兩個庫。任何人都有解決方案?Unity 5.6:Google Play服務和Firebase消息傳遞插件不兼容

+0

我建議使用一個版本只喜歡10.2.6版或11.2.0和不混合。關於你的錯誤,一些論壇認爲這可能與重複的瓶子有關,你應該刪除它們,因此只會使用一個副本。檢查此[SO帖子](https://stackoverflow.com/questions/44468420/unity-error-unable-to-convert-classes-into-dex-format)。 – noogui

+0

發佈你的錯誤和build.gradle –

+0

錯誤最終是這樣的:com.android.dex.DexException:多個dex文件定義Lcom/google/android/gms/auth/api/signin/internal/zzf; –

回答

0

我一直在使用谷歌播放服務插件中的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+"; 

from

// 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

這並沒有解決我所有的問題,但也許它會幫助你。

讓我知道如果你設法解決它,我仍然在尋求解決方案。

+0

供參考:Firebase SDK的4.2.0版本https://firebase.google.com/support/release-notes /unity#4.2.0包含Play Services Resolver 1.2.53版本(https://github.com/googlesamples/unity-jar-resolver),可自動修復衝突的Play Services版本。 – stewartmiles

相關問題