Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Resolved Parameter specified as non-null is null: parameter userId

Discussion in 'Scripting' started by Lena_Gmbh, Jun 18, 2022.

  1. Lena_Gmbh

    Lena_Gmbh

    Joined:
    Oct 14, 2018
    Posts:
    4
    Hi! I'm currently running into an Problem. Every time I press a button in my game I get the error:
    Code (CSharp):
    1. 06-18 14:39:43.171 27787 29365 E Unity   : AndroidJavaException: java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter userId
    2. 06-18 14:39:43.171 27787 29365 E Unity   : java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter userId
    3. 06-18 14:39:43.171 27787 29365 E Unity   :      at com.unity3d.mediation.RewardedAdShowOptions$S2SRedeemData.<init>(Unknown Source:2)
    4. 06-18 14:39:43.171 27787 29365 E Unity   :      at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    5. 06-18 14:39:43.171 27787 29365 E Unity   :      at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
    6. 06-18 14:39:43.171 27787 29365 E Unity   :      at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
    7. 06-18 14:39:43.171 27787 29365 E Unity   :      at android.os.Handler.dispatchMessage(Handler.java:102)
    8. 06-18 14:39:43.171 27787 29365 E Unity   :      at android.os.Looper.loop(Looper.java:246)
    9. 06-18 14:39:43.171 27787 29365 E Unity   :      at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
    10. 06-18 14:39:43.171 27787 29365 E Unity   :   at UnityEngine.AndroidJNISafe.CheckException () [0x0008d] in /Users/bokken/buildslave/unity/build/Modules/AndroidJNI/AndroidJNISafe.cs:24
    11. 06-18 14:39:43.171 27787 29365 E Unity   :   at UnityEngine.AndroidJNISafe.NewObject (System.IntPtr clazz, System.IntPtr methodID, UnityEngine.jvalue[] ar
    12. 06-18 14:39:43.173 27787 29365 I Unity   : Failed to show - java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter userId
    13. 06-18 14:39:43.173 27787 29365 I Unity   : UnityEngine.StackTraceUtility:ExtractStackTrace () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/StackTrace.cs:37)
    14. 06-18 14:39:43.173 27787 29365 I Unity   : UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    15. 06-18 14:39:43.173 27787 29365 I Unity   : UnityEngine.Logger:Log (UnityEngine.LogType,object)
    16. 06-18 14:39:43.173 27787 29365 I Unity   : UnityEngine.Debug:Log (object)
    17. 06-18 14:39:43.173 27787 29365 I Unity   : RewardedAdExample:AdFailedShow (Unity.Services.Mediation.ShowFailedException) (at C:/Users/Lena/MoneyMakerFR/Assets/Scripts/RewardedAdExample.cs:119)
    18. 06-18 14:39:43.173 27787 29365 I Unity   : RewardedAdExample/<ShowAd>d__6:MoveNext () (at C:/Users/Lena/MoneyMakerFR/Assets/Scripts/RewardedAdExample.cs:61)
    19. 06-18 14:39:43.173 27787 29365 I Unity   : System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:InvokeMoveNext (object)
    20. 06-18 14:39:43.173 27787 29365 I Unity   : System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
    21. 06-18 14:39:43.173 27787 29365 I Unity   : System.Threading.ExecutionContext:Run (System.Threading.E
    22. 06-18 14:39:44.182 27787 29365 I Unity   : Ad loaded
    The code is related to the new Unity Mediation.
    Thanks for the help.

    Kind regards,
    Lena.
     
  2. TheFunnySide

    TheFunnySide

    Joined:
    Nov 17, 2018
    Posts:
    192
    I would probably look here first. Attach Debugger , place some break points.

    06-18 14:39:43.173 27787 29365 I Unity : RewardedAdExample:AdFailedShow (Unity.Services.Mediation.ShowFailedException) (at C:/Users/Lena/MoneyMakerFR/Assets/Scripts/RewardedAdExample.cs:119)
    06-18 14:39:43.173 27787 29365 I Unity : RewardedAdExample/<ShowAd>d__6:MoveNext () (at C:/Users/Lena/MoneyMakerFR/Assets/Scripts/RewardedAdExample.cs:61)
     
    Lena_Gmbh likes this.
  3. otters2022

    otters2022

    Joined:
    Jun 5, 2022
    Posts:
    2
    Error occur because Rewarded Ads require S2SRedeemdata.
    You should add S2SRedeemData into your RewardedAdShowOptions
    Code (CSharp):
    1. S2SRedeemData s2SRedeemData = new S2SRedeemData();
    2. s2SRedeemData.UserId = "UserId"
    3. s2SRedeemData.CustomData = "CustomData";
    4. RewardedAdShowOptions showOptions = new RewardedAdShowOptions();
    5. showOptions.S2SData = s2SRedeemData;
    6. showOptions.AutoReload = true;
    7. await ad.ShowAsync(showOptions);
     
    stellamocha, rbitard and Lena_Gmbh like this.
  4. Lena_Gmbh

    Lena_Gmbh

    Joined:
    Oct 14, 2018
    Posts:
    4
    Thanks, now everything is working!
     
  5. rbitard

    rbitard

    Joined:
    Jan 11, 2022
    Posts:
    190
    Yes I have the same problem, even though I don't use s2s. It's a regression from previous version imo