Search Issue Tracker

Fixed in 2022.2.X

Fixed in 2020.3.X, 2021.2.X, 2022.1.X



Found in






Issue ID




[IL2CPP][Android] MarshalDirectiveException error when using Microsoft onnxruntime and building on Android with IL2CPP



Reproduction steps:
1. Open the attached project ""
2. Go to Player Settings and set the "Scripting Backend" to "IL2CPP"
3. Make sure that the Target Architecture is set to ARM64
4. Build and Run the project on an Android device
5. Inspect the Android Logcat after the build is successfully finished

Expected result: No errors in the Android Logcat
Actual result: "MarshalDirectiveException: Cannot marshal P/Invoke call through delegate of type '.DOrtGetApi'" error in the Android Logcat

Reproducible with: 2020.3.27f1, 2021.2.11f1, 2022.1.0b6, 2022.2.0a3
Could not test with: 2019.4.35f1 (Multiple project errors when downgraded)

Reproducible with these devices:
----------, Huawei - (ELS-NX9), Android 10, CPU: NOT FOUND, GPU: Mali-G76
VLNQA00264, Samsung Galaxy S10+ (SM-G975F), Android 10, CPU: NOT FOUND, GPU: Mali-G76
VLNQA00078, Motorola Nexus 6 (Nexus 6), Android 7.1.1, CPU: Snapdragon 805 APQ8084AB, GPU: Adreno (TM) 420
VLNQA00176, Xiaomi Redmi 4 (Redmi 4), Android 6.0.1, CPU: Snapdragon 430 MSM8937, GPU: Adreno (TM) 505

-Setting the Target Architecture to ARM64 and ARM7 then following the same steps results in the same issue
-When the "Scripting Backened" is set to "Mono" and following the same steps results in no issues

  1. Resolution Note (fix version 2022.2):

    Fixed in 2021.2.17f1

  2. Resolution Note (fix version 2022.1):

    Fixed in 2022.1.0b14

  3. Resolution Note (fix version 2021.2):

    Fixed in 2021.2.17f1

  4. Resolution Note (fix version 2020.3):

    Fixed in 2020.3.32f1

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.