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’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Crash in Unity 2017: com.unity3d.player.UnityPlayer

Discussion in '2017.2 Beta' started by Selzier, Sep 1, 2017.

  1. Selzier


    Sep 23, 2014
    In Unity 5.6, the follow code works when when application is built to Android:
    Code (CSharp):
    1. using (AndroidJavaClass player = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) {
    However, in Unity 2017.1 and 2017.2, this line of code causes a crash. Here is the log from logcat:

    Code (CSharp):
    2. FATAL EXCEPTION: main
    3. Process: com.mycompany.ProductName, PID: 19082
    4. java.lang.Error: FATAL EXCEPTION [main]
    5. Unity version     : 2017.2.0b9
    6. Device model      : samsung SM-G930V
    7. Device fingerprint: Verizon/heroqltevzw/heroqltevzw:7.0/NRD90M/G930VVRS4BQH1:user/release-keys
    8. Caused by: java.lang.NoSuchMethodError: [COLOR=#ff4d4d]No direct method <init>(Landroid/content/ContextWrapper;)V in class Lcom/unity3d/player/UnityPlayer; or its super classes (declaration of 'com.unity3d.player.UnityPlayer' appears in /data/app/com.mycompany.ProductName-1/base.apk[/COLOR])
    9.     at
    10.     at
    11.     at
    12.     at
    13.     at
    14.     at
    15.     at$H.handleMessage(
    16.     at android.os.Handler.dispatchMessage(
    17.     at android.os.Looper.loop(
    18.     at
    19.     at java.lang.reflect.Method.invoke(Native Method)
    20.     at$
    21.     at
    It seems to be a constructor call, but I am not sure as it works properly with Unity 5.6.

    In Unity 5.6
    Code (CSharp):
    1. public UnityPlayer(ContextWrapper contextwrapper)
    But in Unity 2017.1
    Code (CSharp):
    1. public UnityPlayer(Context context)
    What can we do to successfully build in Unity 2017?

    Another report of this bug from Google Tango Github:
  2. LeonhardP


    Unity Technologies

    Jul 4, 2016
    Hi Selzier,
    Could you please file a bug report with a minimal reproduction case for this issue and reply in here with the report #?
    GilCat, claytoncurmi and Selzier like this.