Each plugin alone runs fine. But when i try to use them both then i got this error:
Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin/java -Xmx1024M -Dcom.android.sdkmanager.toolsdir="/Users/lnmedia/Development/adt-bundle-mac-x86_64-20131030/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/Unity.app/Contents/BuildTargetTools/AndroidPlayer/sdktools.jar" -
stderr[
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/google/ads/AdRequest$Gender;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
at com.android.dx.command.dexer.Main.processClass(Main.java:685)
The problem is that the play-games library now contains also the AdMob classes. Is it possible somehow to delete the duplicate classes in the JAR file? Or is here anyone who have another solution and is using admob and play services together? I want to avoid to write my own plugin, i just want to use existing ones if possible.
even if it is a little late. I had the same issue a few days ago. Here the repacked lib. (I had to add an empty .txt to the archiv, because I was not able to pack it in a .zip otherwise )
Hi Kalle, i tried your zip but it din show leaderboards… so i made changes to my own play-services.jar file…
Here is the file unzip and just replace default with this file in Assets\Plugins\Android\google-play-services_lib\libs and it will work.
Do as i say and it will work like a charm… Assuming you already have the proper unity plugins for admob and play services. 1) Import both and do the required. 2) Now go to Plugin and search for google-play-services.jar file 3) Do not unzip google-play-services.jar goinside it using services like 7-zip or winrar. 4) Go inside that and search for ads folder and delete it.(I am at office so m not sure of its Directory) 5) Delete ads folder.
After implementing it, simply add GoogleMobileAdsDemoScript.cs in your Asset folder from sample admob project (e.g. HelloWorld from admob plugin example)
Add GoogleMobileAds folder from sample admob project to Asset folder of working project
Now add AndroidManifest file from sample project following folder C:…Project folder\Assets\Plugins\Android to the respective folder of your main project
Add GoogleMobileAdsPlugin folder to C:…Project folder\Assets\Plugins\Android
Now add adactivity.jar from your sample project’s libs folder C:…Project folder\Assets\Plugins\Android\google-play-services_lib\libs to your main project respective libs folder.
Maybe it’s too late to answer, I was facing the same issue, I created a plugin this plugin contains Facebook SDK+Admob+unityads +unity IAP, all of them work together, I’ve created this plugin in unity 5.6.0, but I’ve checked it, it is working fine in unity 2017 as well, there is a scene “DemoScene”, just open it everything is implemented, unity ads, admob, facebook share with callback, unityIAP.