Multiple plugin conflict

At present I am facing problem by using multiple plugin.
I have integrated three plugin into same project named as

  1. Admob Ads
  2. Mobile Social Plugin
  3. IABCombo

First I have first two plugins implemented and everything works fine next I add third plugin, it now showing following message when I try to build it in android.
Following image represent generated message.

As per my analysis for this problem is that:
Unity combine all jar files classes and then use it. So at present there are multiple copies of classes exist after adding third plugin.

I can’t able to figure out how to handle this problem??
Provide some guidance about this problem because I know there are lots of developer facing same problem.

30575-buildfailure.png

First off, for general knowledge, DEX is the process that takes code files (whether it’s your code, or code that is provided in libraries) and converts it into the DEX format (Dalvik Executable).

Libraries are only used for convenience during development: when you build your game, there’s no notion of libraries anymore - it’s all just compiled code.

For this reason, when 2 or more plugins reference the same library (contain 2 copies of a referenced JAR) or define a class with the same name, a conflict occurs, causing this error.

For example: if you are using 2 plugins in your Unity project and both contain a copy of GooglePlayServices.jar, DEX will fail to build your game, since it will try to process multiple copies of the same class.

In your case, it is not clear whether this is the case (multiple copies of the same jar) or whether it’s multiple copies of the same class.

The first one is easier to spot (look for multiple copies of the same JAR). the 2nd one is trickier but it will help if you provided some more information (e.g: is there any extra information in the Unity console? the DEX tool should provide the name of the class that causes the failure for example).

NOTE: In some cases, it gets tricky to find out why the build fails. If all else fails, I offer my help to fix Android related build issues (due to manifest merging, conflicting plugins, etc). Check it out if you’re unable to resolve your issues !

I once had that problem with Google Play Game Services and Facebook SDK v7.4.0
there was 2 files support-v4-23.0.0 and support-v4-23.1.1
so i just remove the last one and it worked

I once had that problem with Google Play Game Services and chartboost ads. The problem lies precisely where you think. The chartboost ads classes were in conflict with those from google play (same name classes for ads). Hence the ads were displayed only via chartboost, the solution was to remove them from the other jar (Google play games). I just changed google play games jar to zip, and opened it in total commander (jar is like zip, you can use any software), than i removed ads folder (could not recall the exact name), changed extension back to jar, and voila I could build without problems :slight_smile:

Another similar problem on dex classes that I once had,was that I got new plugin that required the newest JDK, hence JDK update solve the issue. The best would be if you will copy full error message from console.

We had Chartboost and Google Play services in our project and the issue for us was this line in the Chartboost android manifest that was duplicate in other manifests.

<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

deleting it fixed our issue.

Thanks Butnaru thats true. worked.

In the case of plugins where you can enable or disable libraries, choosing the right ones to disable could help. This was what I did with Stan’s Assets’ Ultimate Mobile Settings.

I solved my issue by logging into unity and …by going onto services tap and turn the ads off. This will solved the issue in my case…

Me helped restart unity!