Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Ads are failing

Discussion in 'Unity Mediation' started by Factori_Danny, Dec 13, 2022.

  1. Factori_Danny

    Factori_Danny

    Joined:
    Dec 13, 2022
    Posts:
    5
    I'm seeing this on Android:


    2022-12-13 08:46:08.696 16385-16705/? E/Ads: Cannot determine request type. Is your ad unit id correct?
    2022-12-13 08:46:08.700 16385-16385/? I/logger: ADAPTER_AD_NETWORK_ERROR: AdMob error with code (1) and message (Error building request URL: Cannot determine request type. Is your ad unit id correct?)
    2022-12-13 08:46:08.700 16385-16674/? I/logger: Line item: ADMOB with values {adUnitId=AdMob_RV_High} failed to load.
    2022-12-13 08:46:08.703 16385-16385/? I/Ads: Ad failed to load : 1
    2022-12-13 08:46:08.709 16385-16698/? E/Ads: Cannot determine request type. Is your ad unit id correct?
    2022-12-13 08:46:08.712 16385-16385/? I/logger: ADAPTER_AD_NETWORK_ERROR: AdMob error with code (1) and message (Error building request URL: Cannot determine request type. Is your ad unit id correct?)
    2022-12-13 08:46:08.712 16385-16669/? I/logger: Line item: ADMOB with values {adUnitId=AdMob_INT_High} failed to load.
    2022-12-13 08:46:08.714 16385-16385/? I/Ads: Ad failed to load : 1


    I am fairly sure everything is setup correctly.

    The ID's in my mediation window in Unity show as follows:

    upload_2022-12-14_8-55-53.png

    And I am sure that my setup is correct:

    Code (CSharp):
    1. private IInterstitialAd _ad;
    2.         private const string AdUnitId = "Interstitial_Android";
    3.  
    4.         public void SetupAd()
    5.         {
    6.             //Create
    7.             _ad = MediationService.Instance.CreateInterstitialAd(AdUnitId);
    8.  
    9.             //Subscribe to events
    10.             _ad.OnClosed += AdClosed;
    11.             _ad.OnClicked += AdClicked;
    12.             _ad.OnLoaded += AdLoaded;
    13.             _ad.OnFailedLoad += AdFailedLoad;
    14.            
    15.             // Impression Event
    16.             MediationService.Instance.ImpressionEventPublisher.OnImpression += ImpressionEvent;
    17.         }
    NOTE: I am setting up unity services much earlier in the app using:

    Code (CSharp):
    1. var initializationOptions = new InitializationOptions();
    2.             initializationOptions.SetGameId(GameId);
    3.             await Task.WhenAny(UnityServices.InitializeAsync(), Task.Delay(3000));
    ^^^ I am also connected to the internet and can see that this is finishing correctly as desired.

    Here are the look of my unity waterfalls for my rewarded:

    upload_2022-12-14_8-58-15.png

    Please help thankyou
     
  2. Factori_Danny

    Factori_Danny

    Joined:
    Dec 13, 2022
    Posts:
    5
    Noticed this error:


    2022-12-13 10:26:05.270 20040-20099/? E/Unity: AndroidJavaException: java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.i.d, parameter userId
    java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.i.d, parameter userId
    at com.unity3d.mediation.RewardedAdShowOptions$S2SRedeemData.<init>(Unknown Source:2)
    at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
    at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
    at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
    at UnityEngine.AndroidJNISafe.NewObject (System.IntPtr clazz, System.IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <00000000000000000000000000000000
     
  3. Factori_Danny

    Factori_Danny

    Joined:
    Dec 13, 2022
    Posts:
    5
  4. Factori_Danny

    Factori_Danny

    Joined:
    Dec 13, 2022
    Posts:
    5
    upload_2022-12-13_10-43-9.png

    Should I be using these ID's? but then how would it use other Networks? Also how is this setup as I don't have an admob account that I know of, this was automatically built by Unity? When you do code sample it uses the normal app id's as I had them before
     
  5. Factori_Danny

    Factori_Danny

    Joined:
    Dec 13, 2022
    Posts:
    5
    It's working now because I added s2s redeem data like this:

    Code (CSharp):
    1. try
    2.                 {
    3.                     var s2SRedeemData = new S2SRedeemData();
    4.                     s2SRedeemData.UserId = "UserId";
    5.                     s2SRedeemData.CustomData = "CustomData";
    6.                     var showOptions = new RewardedAdShowOptions {S2SData = s2SRedeemData, AutoReload = true};
    7.                     showOptions.AutoReload = true;
    8.                     await _ad.ShowAsync(showOptions);
    9.                     AdShown();
    10.                 }
    This isn't in the code generator OR the documentation for unity mediation. Please update the documentation!
     
  6. jcGrenier

    jcGrenier

    Unity Technologies

    Joined:
    Feb 23, 2021
    Posts:
    145
    Hi @Factori_Danny ,
    I remember a bug from a while ago where s2s mistakenly became mandatory but it has been fixed. I would recommend that you update your package, or if it is already on the latest version please send us a copy of your logs so we can investigate.

    Thanks for the feedback!