Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Android] [Exception] ExecutionEngineException AOT Error

Discussion in 'Scripting' started by jGate99, May 18, 2019.

  1. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,935
    Hi there,

    When i run IL2CPP based Android build on device i get following error

    [Exception] ExecutionEngineException: Attempting to call method 'FileSave<System.Int64>' for which no ahead of time (AOT) code was generated.

    Here is FileSave method
    Code (CSharp):
    1.     public override void FileSave<TValue>(string filepath, string key, TValue value, string password = "password")
    2.        
    3.         {
    4.            
    5.             ES3File es3File = new ES3File(filepath, getSettings(password));
    6.  
    7.             es3File.Save<TValue>(key, value);
    8.  
    9.             es3File.Sync();
    10.  
    11.  
    12.         }
    I also explicitly added following method to force AOT code generation as described here
    https://docs.unity3d.com/Manual/ScriptingRestrictions.html


    Code (CSharp):
    1. public void UsedOnlyForAOTCodeGeneration()
    2.         {
    3.            
    4.             // IL2CPP needs only this line.
    5.             FileSave<long>("", "", 12L);
    6.             FileSave("", "", 12);
    7.            
    8.            
    9.            
    10.            
    11.         }
    I tried all combinations but But i still get error.
    So here for expert advise.
    Thanks
     
  2. fdavila

    fdavila

    Joined:
    Sep 9, 2021
    Posts:
    1
    :( I'm having the same issue, with Hololens 2
     
  3. TiG

    TiG

    Joined:
    Feb 28, 2011
    Posts:
    311
    Bump
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,514
    Let's stop bumping threads from 2019 and evolve to a higher plane of existence.

    First, START YOUR OWN POST... It's FREE!

    Second, use this as a guide for communicating technical problems to complete strangers online:

    How to report your problem productively in the Unity3D forums:

    http://plbm.com/?p=220

    This is the bare minimum of information to report:

    - what you want
    - what you tried
    - what you expected to happen
    - what actually happened, especially any errors you see
    - links to documentation you used to cross-check your work (CRITICAL!!!)

    If you post a code snippet, ALWAYS USE CODE TAGS:

    How to use code tags: https://forum.unity.com/threads/using-code-tags-properly.143875/
     
  5. TiG

    TiG

    Joined:
    Feb 28, 2011
    Posts:
    311
    Ooooo so angry, I want to know the solution to what the OP asked, relax...