0

I'm cannot make a build after installing both the Google Play Services plugin and the Firebase Messaging plugin. I'm using the latest versions of both. I get the "Unable to convert classes into dex format" error. The two libraries that conflict are play-services-auth-10.2.6 and play-services-base-11.2.0. Google Play Services resolver grabs these two libraries for me. Anyone have a solution?

Tony Ho
  • 1
  • 1
  • I suggest using one version only like 10.2.6 version or 11.2.0 and not mixed. With regard to your error, some forums say this might be related to duplicate jars and you should delete them so only one copy will be used. Check this [SO post](https://stackoverflow.com/questions/44468420/unity-error-unable-to-convert-classes-into-dex-format). – ReyAnthonyRenacia Sep 21 '17 at 03:37
  • Post your error and build.gradle – Gabriele Mariotti Sep 21 '17 at 17:53
  • the error ends up being something like this: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/auth/api/signin/internal/zzf; – Tony Ho Sep 22 '17 at 06:31
  • seems like a known issue? https://github.com/playgameservices/play-games-plugin-for-unity/issues/1892 – Tony Ho Sep 22 '17 at 06:31

2 Answers2

0

I've been messing around with the GPGSDependencies.xml and the PluginVersion.cs file from the google play services plugin. I was attempting to make the library versions identical.

I did manage to get identical library versions, this did solve the DEX format issue, but when I made a call for authenticating a google account my app crashed.

This is what I did: In GPGSDependencies.xml I changed the 10+ in these lines to 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+">

And I also changed the lines in PluginVersion.cs to

// 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+";

The PluginVersion.cs alteration was mentioned here: https://github.com/playgameservices/play-games-plugin-for-unity/issues/1892#issuecomment-325555313.

This didn't solve all my problems but maybe it will help you.

Let me know if you managed to solve it, I am still working on a solution.

Calvin Wu
  • 1
  • 1
  • FYI: The 4.2.0 version of the Firebase SDK https://firebase.google.com/support/release-notes/unity#4.2.0 includes the 1.2.53 version of the Play Services Resolver (https://github.com/googlesamples/unity-jar-resolver) which automatically fixes conflicting Play Services versions for you. – stewartmiles Oct 03 '17 at 22:50
0

I got it to work with the latest google play services resolver.

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

Tony Ho
  • 1
  • 1