Search Unity

Admob Mediation with Unity Ads

Discussion in 'Unity Ads & User Acquisition' started by Ogien, Aug 28, 2018.

  1. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    165
    I am attempting to integrate Admob Mediation with Unity Ads, what I mean is I would like the Admob Unity SDK to drive the mediation and decide if it should display the Admob or Unity Ad based on highest revenue.

    As my starting point I am using this tutorial

    https://developers.google.com/admob/unity/mediation/unity

    Although it is out of date I was able to account for the differences in the dashboard and complete all the steps.

    On the Unity Side was unable to simply turn on the Unity Ads service as this gave me errors. After some email exchanges with Unity Support I was told that instead I had to import the package from the Unity Asset Store which I did.

    My understanding is that as long as the Admob SDK is in my Unity Project along the side of the Unity Ads SDK and the Mediation is setup correctly on the Admob Dashboard then the Admob SDK should be able to correctly choose the best paying ad and display it.

    Although I am calling the Admob SDK code as usual I am not making any calls or initiations to the Unity SDK (I am not sure that is correct)

    However in reality all I ever get are Admob Ads with 0 Unity Ads impressions even after several weeks of running.

    I should ad that I am not using Rewarded Ads just Interstitial ads.

    I tried contacting Unity Support about this but it has now been 1 week since I received a reply (despite several emails asking for more help).

    Because I see the Network Request coming through the mediation window in Admob & Unity Ads I feel like I am close but I must me missing something because I never get any impressions.

    I am using Unity 2017.3.1f1

    Any ideas?
     
    Last edited: Aug 28, 2018
  2. RozekEnhance

    RozekEnhance

    Joined:
    Feb 2, 2017
    Posts:
    15
    I'm not sure how the admob mediation SDK works with unity, but you can simplify your integration by using Enhance.
    We support admob and a wide range of networks and integration takes only minutes. With Enhance, you can take the guesswork and time out of integrating SDKs.

    For more info, just follow the link : https://goo.gl/VLvSoQ
    Good Luck!
     
  3. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    165
    Now that we got the commercial offers out of the way, is there someone that has done this that can point me in the right direction? Anyone from Unity? This should be super simple why is there no documentation about how to implement this?
     
    Endahs likes this.
  4. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    165
    OK so I got it working on my own. The solution was actually always in the Admob Unity Ads Mediation Tutorial, I just missed it.

    https://developers.google.com/admob/unity/mediation/unity

    To get Admob to Mediate Unity Ads you need to:

    1) Download and setup the official Google Admob Plugin for Unity:
    https://github.com/googleads/googleads-mobile-unity/releases
    2) Setup the above so it displays Admob Ads like you would usually, no code calling Unity Ads is necessary.
    3) Download and install the Google Mobile Ads Unity Ads Mediation Plugin
    https://bintray.com/google/mobile-ads-adapters-unity/GoogleMobileAdsUnityAdsMediation

    The only code you need to write is the code you would usually implement to show Admob Ads. Once you get that working importing the second plugin and setting Mediation up correctly on the Admob Dashboard is enough.

    IMPORTANT: You do not import the Unity Ads plugin from the Asset Store. Doing that will not work, I have spend a month hitting my head against that door. You also do not enable the Unity Ads service in the services window.

    Good Luck
     
  5. Nowlz

    Nowlz

    Joined:
    Nov 18, 2016
    Posts:
    55
    It looks like I may be hitting the same issue, I have everything seemingly set up correctly and I can see 100's of requests being made for Unity Ads but no impressions. However as you mentioned I've installed the Unity Ads plugin and have Unity Ads enabled in the services window.

    Are you saying that simply deselecting Unity Ads in the services window within the editor worked for you? Or did you have to uninstall the Unity Ads plugin as well?
     
  6. xtrecoolx

    xtrecoolx

    Joined:
    Nov 9, 2018
    Posts:
    1
    I am having the same issue. Can someone shed light on to this ? I see that Admob is calling Unity Ads but the ads are never displayed.
     
  7. Ryoha

    Ryoha

    Joined:
    Mar 5, 2017
    Posts:
    8
    I did exactly like this, but still only admob ads show, and unity ads never show.
     
  8. LAKSHAYMAVIA

    LAKSHAYMAVIA

    Joined:
    Aug 28, 2018
    Posts:
    27
  9. M_G_L

    M_G_L

    Joined:
    Apr 4, 2017
    Posts:
    7

    Thanks!
     
  10. ddadkhah

    ddadkhah

    Joined:
    Nov 6, 2017
    Posts:
    59
    Hi.
    Does admob get money from you, when you show unity ads using admob SDK?
     
  11. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Hi, facing this problem during build. May be something with gradle?

    CommandInvokationFailure: Gradle build failed.
    C:\INSTALLED\Unity 2018.4.3f1\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\OpenJDK\Windows\bin\java.exe -classpath "C:\INSTALLED\Unity 2018.4.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.6.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

    stderr[

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':processReleaseResources'.
    > Android resource linking failed
    Output: C:\PROJECTS\Google Mobile Mediation\Temp\gradleOut\build\intermediates\merged_manifests\release\processReleaseManifest\merged\AndroidManifest.xml:36: error: unexpected element <queries> found in <manifest>.

    Command: C:\Users\UMI\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\3612db01bb1b889c1b09c4fb3b8aca3f\aapt2-3.2.0-4818971-windows\aapt2.exe link -I\
    C:\ANDROID_SDK\platforms\android-30\android.jar\
    --manifest\
    C:\PROJECTS\Google Mobile Mediation\Temp\gradleOut\build\intermediates\merged_manifests\release\processReleaseManifest\merged\AndroidManifest.xml\
    -o\
    C:\PROJECTS\Google Mobile Mediation\Temp\gradleOut\build\intermediates\processed_res\release\processReleaseResources\out\resources-release.ap_\
    -R\
    @C:\PROJECTS\Google Mobile Mediation\Temp\gradleOut\build\intermediates\incremental\processReleaseResources\resources-list-for-resources-release.ap_.txt\
    --auto-add-overlay\
    --java\
    C:\PROJECTS\Google Mobile Mediation\Temp\gradleOut\build\generated\not_namespaced_r_class_sources\release\processReleaseResources\r\
    --custom-package\
    com.gamexis.googlemedtest\
    -0\
    apk\
    -0\
    .unity3d\
    -0\
    .ress\
    -0\
    .resource\
    -0\
    .obb\
    --output-text-symbols\
    C:\PROJECTS\Google Mobile Mediation\Temp\gradleOut\build\intermediates\symbols\release\R.txt\
    --no-version-vectors
    Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #0
    Output: C:\PROJECTS\Google Mobile Mediation\Temp\gradleOut\build\intermediates\merged_manifests\release\processReleaseManifest\merged\AndroidManifest.xml:36: AAPT: error: unexpected element <queries> found in <manifest>.

    Command: C:\Users\UMI\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\3612db01bb1b889c1b09c4fb3b8aca3f\aapt2-3.2.0-4818971-windows\aapt2.exe link -I\
    C:\ANDROID_SDK\platforms\android-30\android.jar\
    --manifest\
    C:\PROJECTS\Google Mobile Mediation\Temp\gradleOut\build\intermediates\merged_manifests\release\processReleaseManifest\merged\AndroidManifest.xml\
    -o\
    C:\PROJECTS\Google Mobile Mediation\Temp\gradleOut\build\intermediates\processed_res\release\processReleaseResources\out\resources-release.ap_\
    -R\
    @C:\PROJECTS\Google Mobile Mediation\Temp\gradleOut\build\intermediates\incremental\processReleaseResources\resources-list-for-resources-release.ap_.txt\
    --auto-add-overlay\
    --java\
    C:\PROJECTS\Google Mobile Mediation\Temp\gradleOut\build\generated\not_namespaced_r_class_sources\release\processReleaseResources\r\
    --custom-package\
    com.gamexis.googlemedtest\
    -0\
    apk\
    -0\
    .unity3d\
    -0\
    .ress\
    -0\
    .resource\
    -0\
    .obb\
    --output-text-symbols\
    C:\PROJECTS\Google Mobile Mediation\Temp\gradleOut\build\intermediates\symbols\release\R.txt\
    --no-version-vectors
    Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #0

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    * Get more help at https://help.gradle.org

    BUILD FAILED in 3s
    ]
    stdout[
    Observed package id 'extras;intel;Hardware_Accelerated_Execution_Manager' in inconsistent location 'C:\ANDROID_SDK\.temp\PackageOperation01' (Expected 'C:\ANDROID_SDK\extras\intel\Hardware_Accelerated_Execution_Manager')
    :checkReleaseClasspath UP-TO-DATE
    :preBuild UP-TO-DATE
    :GoogleMobileAdsPlugin.androidlib:preBuild UP-TO-DATE
    :GoogleMobileAdsPlugin.androidlib:preReleaseBuild UP-TO-DATE
    :GoogleMobileAdsPlugin.androidlib:checkReleaseManifest
    :GoogleMobileAdsPlugin.androidlib:processReleaseManifest
    :preReleaseBuild UP-TO-DATE
    :GoogleMobileAdsPlugin.androidlib:compileReleaseAidl NO-SOURCE
    :compileReleaseAidl NO-SOURCE
    :GoogleMobileAdsPlugin.androidlib:packageReleaseRenderscript NO-SOURCE
    :compileReleaseRenderscript UP-TO-DATE
    :checkReleaseManifest UP-TO-DATE
    :generateReleaseBuildConfig UP-TO-DATE
    :prepareLintJar UP-TO-DATE
    :mainApkListPersistenceRelease UP-TO-DATE
    :generateReleaseResValues UP-TO-DATE
    :generateReleaseResources UP-TO-DATE
    :GoogleMobileAdsPlugin.androidlib:compileReleaseRenderscript
    :GoogleMobileAdsPlugin.androidlib:generateReleaseResValues
    :GoogleMobileAdsPlugin.androidlib:generateReleaseResources
    :GoogleMobileAdsPlugin.androidlib:packageReleaseResources
    :mergeReleaseResources UP-TO-DATE
    :createReleaseCompatibleScreenManifests UP-TO-DATE
    :processReleaseManifest
    :splitsDiscoveryTaskRelease UP-TO-DATE
    :GoogleMobileAdsPlugin.androidlib:generateReleaseRFile
    :processReleaseResources FAILED
    19 actionable tasks: 8 executed, 11 up-to-date
    ]
    exit code: 1
    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <103137eb219949558cde9ab87892d16a>:0)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <103137eb219949558cde9ab87892d16a>:0)
    UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <103137eb219949558cde9ab87892d16a>:0)
    UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <103137eb219949558cde9ab87892d16a>:0)
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <103137eb219949558cde9ab87892d16a>:0)
    Rethrow as GradleInvokationException: Gradle build failed
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <103137eb219949558cde9ab87892d16a>:0)
    UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <103137eb219949558cde9ab87892d16a>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <103137eb219949558cde9ab87892d16a>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    Any possible fix for this?

    Google Mobile Ads v4.2.1
    Unity 2018.4.3
     
  12. xjjon

    xjjon

    Joined:
    Apr 15, 2016
    Posts:
    613
    You can fix it by following these instructions:

    https://developers.google.com/ar/develop/unity/android-11-build#unity_20193_and_20194

    1) Use gradle 5.6.4
    2) Override gradle template to use 5.6.4
     
  13. YousafGrewal

    YousafGrewal

    Joined:
    Jul 5, 2018
    Posts:
    30
    Thans broh it hepls me a loot