Unable to convert classes into dex format

Hey there,

I’m working on a mobile game and have successfully implemented the Facebook API and AdMob for both iOS and Android. I recently purchased an asset to help with IAP for both iOS and Android. After getting the plugin to work for iOS, I continue to get this error when building for Android:

CommandInvokationFailure: Unable to convert classes into dex format.
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir=“/Users/adamcarmichael/Library/Android/sdk/tools” -Dfile.encoding=UTF8 -jar “/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar” -

stderr[
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzqj;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzqj$zza;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzqk;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzql;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzqm;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzqn;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzqo;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzqp;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzqq;

…(the error goes on, so if you need more info please ask and I’ll post the entire thing)

I’ve been searching the web for a solution but no luck. Does anybody here have any better idea what this error means? Thanks!

(Apologies if this is in the wrong place. Thanks)

stderr[ Uncaught translation error:
java.lang.IllegalArgumentException:
already added:
Lcom/google/android/gms/internal/zzqj;

The error means that a class with the same name (‘Lcom/google/android/gms/internal/zzqj’) was already added to the DEX.

At build time, all your plugins are compiled together into a single package. if you have multiple classes with the same name, the build will fail with such a message, since it’s not possible to package the same class more than once into the .apk.

Judging by the name of the class in question, it is related to Google play services.
My guess is that you have google play services libraries at different versions (e.g: one .aar file at 9.2.1 and another at 10.2.0 for example).

you should always make sure all Google play services libraries have the same version.

I started getting something similar. I updated GameAnalytics SDK today, nothing else. The build for Android worked before this, so probably something wrong there, but how do I fix it?
What should I look for? How do I make sure “Google play services libraries have the same version”?
Please help, I am totally stuck now.

This is the log:

CommandInvokationFailure: Unable to convert classes into dex format.
/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir=“/Users/purbanics/Library/android-sdk-macosx/tools” -Dfile.encoding=UTF8 -jar “/Applications/Unity541f1/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar” -

stderr[
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/ads/internal/overlay/zzs;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzek;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzel;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzem;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzen;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzeo;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzep;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzeq;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzeq$zza;

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:608)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at SDKMain.main(SDKMain.java:129)
Caused by: java.lang.InterruptedException: Too many errors
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:600)
… 9 more
]
stdout[
processing archive /Users/purbanics/Documents/Unity Projects/English/English/Temp/StagingArea/android-libraries/play-services-ads-9.4.0/libs/./classes.jar…
ignored resource META-INF/
ignored resource META-INF/MANIFEST.MF
ignored resource com/
ignored resource com/google/
ignored resource com/google/android/
ignored resource com/google/android/gms/
ignored resource com/google/android/gms/ads/
ignored resource com/google/android/gms/ads/internal/
processing com/google/android/gms/ads/internal/ClientApi.class…
processing com/google/android/gms/ads/internal/InterstitialAdParameterParcel.class…
ignored resource com/google/android/gms/ads/internal/formats/