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

Showcase How to solve Android error: no static method with name='loadBanner'

Discussion in 'Unity Ads & User Acquisition' started by _geo__, Jun 16, 2023.

Thread Status:
Not open for further replies.
  1. _geo__


    Feb 26, 2014
    In case anyone has got this error:
    Code (csharp):
    1. unity android Error Unity java.lang.NoSuchMethodError: no static method with name='loadBanner' signature='(Lcom.unity3d.player.UnityPlayerActivity;)V' in class Ljava.lang.Object;
    Make sure your placementId is NOT null. The c# API has a method for placementId = null but the java side does not. A likely cause is a timing problem (calling load before the placementId is set).

    Observed in Unity 2021.3.26f1 with Advertisement Legacy 4.4.2


    This code tries to call a non-existent java method if placementId is null:
    Code (CSharp):
    1. if (placementId != null)
    2. {
    3.     m_BannersClass.CallStatic("loadBanner", m_CurrentActivity, placementId);
    4. }
    5. else
    6. {
    7.     m_BannersClass.CallStatic("loadBanner", m_CurrentActivity); // This will always FAIL because there is no java method for this.
    8. }
    No such method in the java source. I guess no one ever tested it with a null placement id.

    My understand is that all of this is now legacy code and no fix will be done. May it help others who (like me) have not yet upgraded.
    ap-unity likes this.
Thread Status:
Not open for further replies.