[2019.2.14f1 or above] AndroidJavaException: java.lang.NullPointerException

2019-12-10 22:53:43.570 22973-23004/com.xxxx.NewUnityProject E/Unity: AndroidJavaException: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Class.getName()' on a null object reference
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Class.getName()' on a null object reference
        at com.unity3d.player.ReflectionHelper.getMethodID(Unknown Source:224)
        at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
        at com.unity3d.player.UnityPlayer.c(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.loop(Looper.java:201)
        at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
      at UnityEngine._AndroidJNIHelper.GetMethodID (System.IntPtr jclass, System.String methodName, System.String signature, System.Boolean isStatic) [0x00041] in /Users/builduser/buildslave/unity/build/Modules/AndroidJNI/AndroidJava.cs:1396
      at UnityEngine.AndroidJNIHelper.GetMethodID (System.IntPtr java

Reproducible with: 2019.2.15f1 2019.2.14f1
No problem with : 2019.2.8f1

The demon project is in the attached files.

5269011–527409–UnityProject.zip (626 KB)

This looks like a bug I’m investigating right now. Monitor it here:

1 Like

So I’ve found the cause for it. The fix is coming.
If you need it urgently, then pass the exact class for static method you try to call (the one that defines that method). Currently it doesn’t walk up the hierarchy and only searches for static methods in the given class.

1 Like

We can confirm the problem: calling a static “inherited” method on a Java class does not work in all recent version of Unity 2019.2.
Switching over to call the static method on the implementing class fixes the problem (and is IMHO also the better way).

Hi. Where can I found 2019.2.22f version of the Unity? Your ticket contains information that this bug has been fixed there. But I can’t find that version.

2 Likes

The ticket mentions 2019.2.22f1, but that version is not available on the downloads page. Please provide a link for this version.

2019.2 is no longer supported, please switch to 2019 LTS