Unity Ads Mediation

278 views
Skip to first unread message

Tom Morgan

unread,
Feb 12, 2018, 9:01:39 PM2/12/18
to Google Mobile Ads SDK Developers
Hi I'm having some trouble setting up Admob with UnityAds mediation,

Unity version: 2017.1.0p4
Admob plugin version: 3.11.0
Google Play Services version: 46

So I implemented the admob plugin with no issues, I can see google ads perfectly fine. I turned on the UnityAds service from in the editor and successfully got a test UnityAd, by calling for one directly.

I assumed all was fine and setup my admob mediation group with my UnityAd project settings. I noticed that I was getting a few hundred requests however, admob was reporting 0 impressions, as was the UnityAds dashboard.

I loaded up logcat and noticed that UnityAds was receiving "No fill". After some research I came across a post which said, that this can happen if you haven't imported the "google mobile ads mediation plugin for UnityAds". (which I hadn't, so I assume this is my problem).

So I downloaded and imported the mediation plugin and now I can't build, I get the error below:

CommandInvokationFailure: Unable to convert classes into dex format.
E:/Program Files/JDK8\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="F:/Work/AndroidSDK\tools" -Dfile.encoding=UTF8 -jar "E:\Program Files\Unity 201710p4\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

stderr[
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/ads/BuildConfig;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/ads/IUnityAdsListener;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/ads/UnityAds;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/ads/UnityAds$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/ads/UnityAds$2;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/ads/UnityAds$FinishState;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/ads/UnityAds$PlacementState;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/ads/UnityAds$UnityAdsError;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/ads/adunit/AdUnitActivity;

Any help with this problem would be great,

Thanks,

Tom.

mobileadssdk-a...@google.com

unread,
Feb 13, 2018, 1:06:39 AM2/13/18
to Tom Morgan, Google Mobile Ads SDK Developers
Hi Tom,

Make sure that you have followed this guide when mediating with UnityAds via the official Google Mobile Ads Unity plugin

That said, when mediating with UnityAds via the official Google Mobile Ads Unity plugin, you don't need to enable the UnityAds service in the Unity editor. Try disabling the UnityAds service, then re-build or re-import the Google Mobile Ads Unity plugin without the UnityAds service and see if the build error persists.

Regards,
Ivan Bautista
Mobile Ads SDK Team

Tom Morgan

unread,
Feb 13, 2018, 9:58:33 AM2/13/18
to Google Mobile Ads SDK Developers
Thanks for replying.

I followed that guide originally, what confused me was the section called "Import the Unity SDK and adaptor" since it only said to import the mediation plugin, not an sdk, I assumed I needed to turn the Ads service on to get the sdk.

So I just deleted and re-imported the Google Mobile Ads Unity plugin, then the mediation plugin. If everything is correctly set up in my admob account, it should work correctly now?

I'm looking at logcat with the tag Ads and there's no mention of mediation or UnityAds, is this normal? If so, what is the correct way to test that it is working correctly? (I'm trying to mediate an interstitial and a rewarded video ad unit)

I/Ads     (13656): Starting ad request.
I/Ads     (13656): This request is sent from a test device.
W/Ads     (13656): Not retrying to fetch app settings
W/Ads     (13656): Invoke Firebase method getInstance error.
W/Ads     (13656): The Google Mobile Ads SDK will not integrate with Firebase. Admob/Firebase integration requires the latest Firebase SDK jar, but Firebase SDK is either missing or out of date
I/Ads     (13656): Starting ad request.
I/Ads     (13656): This request is sent from a test device.
W/Ads     (13656): Not retrying to fetch app settings
I/Ads     (13656): Starting ad request.
I/Ads     (13656): Use AdRequest.Builder.addTestDevice("") to get test ads on this device.
W/Ads     (13656): Not retrying to fetch app settings
W/Ads     (13656): Server parameters: {"gwhirl_share_location":"1","pubid":"\/cak=no_cache&cadc=dg&caqid=gfuCWpLEDLHEtgeegY7QDw"}
W/Ads     (13656): Server parameters: {"gwhirl_share_location":"1","pubid":"\/cak=no_cache&cadc=dg&caqid=gfuCWpLEDLHEtgeegY7QDw"}
I/Ads     (13656): Starting ad request.
I/Ads     (13656): Use AdRequest.Builder.addTestDevice("") to get test ads on this device.
W/Ads     (13656): Not retrying to fetch app settings
I/Ads     (13656): Ad finished loading.
I/Ads     (13656): Scheduling ad refresh 70000 milliseconds from now.
I/Ads     (13656): Ad finished loading.
I/Ads     (13656): Ad finished loading.
I/Ads     (13656): Ad finished loading.

Thanks,

Tom

mobileadssdk-a...@google.com

unread,
Feb 14, 2018, 2:00:13 AM2/14/18
to Tom Morgan, Google Mobile Ads SDK Developers
Hi Tom,

Thank you for getting back to us with your findings and new helpful details.

I'm glad to see that you were able to build the app with the official Google Mobile Ads Unity plugin successfully. If you were able to follow all the necessary instructions in this guide for mediating with UnityAds, then it should work as expected.

To test your integration with UnityAds, try enabling test Ads on the Unity dashboard as per this section and set a higher eCPM value for UnityAds in your AdMob dashboard. For testing purposes, you may also disable any other Ad Networks mediated with your Ad Unit just so that you can test out mediation with UnityAds. After which, try loading ads again with the Ad Unit Id that is mediated with UnityAds only with a high eCPM value, then see if you can load test ads.

Most likely, you will be receiving a log message containing the parameters Game ID and Placement ID when an Ad request for UnityAds was successfully sent similar to the log message below.

I Ads     : Starting ad request.
.......
W Ads     : Server parameters: {"gameId":"YOUR GAME ID","gwhirl_share_location":"1","zoneId":"YOUR PLACEMENT ID"}

Also, for us to check on our end, could you provide to us the Ad Unit Id in question privately using Reply privately to author option? 

Tom Morgan

unread,
Feb 14, 2018, 1:45:37 PM2/14/18
to Google Mobile Ads SDK Developers
Hi there,

Thanks for all of your help. I have successfully received a unity ad.

I think the problem yesterday was, after I have re-imported the plugin and posted that logcat, I hadn't left my mediation group enough time to unpause. Today I unpaused it, tested it 2 hours later and was able to get a UnityAd.

Thanks again for all of your help,

Tom.
Reply all
Reply to author
Forward
0 new messages