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. Dismiss Notice

IL2CPP Android crash at runtime in the first script

Discussion in 'Android' started by Karrix, Aug 29, 2020.

  1. Karrix

    Karrix

    Joined:
    Feb 10, 2019
    Posts:
    10
    Hello,
    I create an Android Game which will be upload on playstore but playstore need ARM64 version then I need to compile the game with IL2CPP.
    The problem is that Mono work but not IL2CPP.
    The compilation work well but at runtime on my mobile (Xiaomi redmi note 8 pro) I get this error wich loop infinitely:

    08-29 14:12:13.164 23957 23999 E Unity : at BalekLogo.Update () [0x00000] in <00000000000000000000000000000000>:0
    08-29 14:12:13.164 23957 23999 E Unity :
    08-29 14:12:13.164 23957 23999 E Unity : (Filename: currently not available on il2cpp Line: -1)
    08-29 14:12:13.164 23957 23999 E Unity :
    08-29 14:12:13.180 23957 23999 E Unity : NullReferenceException: Object reference not set to an instance of an object.

    BalekLogo is the first script executed in the game.
    If I use some Debug.Log to found the bug, it's when I use a method of component script. The variable is null but I set it in the Start() method of the script with a GetComponent.
    I said it again, it work well without error on MONO. It seem to be IL2CPP not run Start() method...

    Other informations:
    - I use Newtonsoft Json DLL
    - I use Facebook SDK and Audience SDK
    - I use .NET 4.x
    - I use Some dynamics variables
    - I use Unity 2020.1.2f1
     
  2. andy_gruening

    andy_gruening

    Joined:
    Feb 27, 2019
    Posts:
    2
    The code of your file would be good. It could be that the component you are calling the method from, might not be compatible with IL2CPP, if its a third party library or asset. Instead of loading the component dynamically, you can try to assign the component in the inspector manually.
    But you need to send the code in order to have a better view on your problem.
     
  3. Karrix

    Karrix

    Joined:
    Feb 10, 2019
    Posts:
    10
    I think I found the problem. The Start method crash when I use newtonsoft json to parse json. I think it's not compatible with il2cpp

    Edit: Sorry it was because I use JObject as dynamic and it's not good with IL2CPP.
    How to close thread ?
     
    Last edited: Sep 2, 2020
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,773
    I don't think there is a way to close a thread. I'm glad you tracked down the issue though!