Skip to content

Unity 2021.3.21f1 wants to access mUnityPlayer field #68

Description

@Luluno01

After upgrading to editor version 2021.3.21f1, Android build is no longer working:

E Unity   : AndroidJavaException: java.lang.NoSuchFieldError: no "Ljava/lang/Object;" field "mUnityPlayer" in class "Lcom/example/MainActivity;" or its superclasses
E Unity   : java.lang.NoSuchFieldError: no "Ljava/lang/Object;" field "mUnityPlayer" in class "Lcom/example/MainActivity;" or its superclasses
E Unity   :      at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
E Unity   :      at com.unity3d.player.UnityPlayer.access$500(Unknown Source:0)
E Unity   :      at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:126)
E Unity   :      at android.os.Handler.dispatchMessage(Handler.java:102)
E Unity   :      at android.os.Looper.loop(Looper.java:233)
E Unity   :      at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
E Unity   :   at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
E Unity   :   at UnityEngine.AndroidJNISafe.GetFieldID (System.IntPtr clazz, System.String name, System.String sig) [0x00000] in <00000000000000000000000000000000>:0
E Unity   :   at UnityEngine._AndroidJNIHelper.GetFieldID (System.IntPtr jclass, System.String fieldName, System.Str

Somehow the Unity native code wants to access mUnityPlayer field of current activity class, which is never defined but it worked in previous versions. After looking into the built-in UnityPlayerActivity I found protected UnityPlayer mUnityPlayer; // don't change the name of this variable; referenced from native code, which has been there before it breaks. So it looks like there is change in the native code, but I can't find the source code of it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions