Cabbage Logo
Back to Cabbage Site

DllNotFoundException when Unity deploys to Android

I realize that this topic came up some times already, I just did not manage to find a good workaround.

I build a very small test project with a script, which just sends a score event:

using UnityEngine;
using UnityEngine.UI;


public class CSound : MonoBehaviour
{
    CsoundUnity csound;
    Text output;

    void Start()
    {
        csound = GameObject.Find("CSound").GetComponent<CsoundUnity>();
        output = GameObject.Find("Text").GetComponent<Text>();
    }

    void Update()
    {
        if (Input.GetMouseButton(0) || Input.touchCount > 0)
        {
            csound.SendScoreEvent("i 1 0 .2 -1");
            output.text = "Sent...";
        }
    }
}

It runs without problems in the editor.
When I deploy it to Android, the message “Sent…” is never shown. Instead I get the following error on the debug console…

04-14 14:17:21.805 18703 21977 E Unity   : DllNotFoundException: csoundandroid
04-14 14:17:21.805 18703 21977 E Unity   :   at (wrapper managed-to-native) csoundcsharp.Csound6+NativeMethods.csoundInitialize(int)
04-14 14:17:21.805 18703 21977 E Unity   :   at CsoundUnityBridge..ctor (System.String csdFile,     System.Collections.Generic.List`1[T] environmentSettings) [0x00017] in C:\Development\Unity\SwipeSynth\CSound\Library\PackageCache\com.csound.csoundunity@6464d3c330\Runtime\CsoundUnityBridge.cs:114 
04-14 14:17:21.805 18703 21977 E Unity   :   at CsoundUnity.Awake () [0x000bf] in C:\Development\Unity\SwipeSynth\CSound\Library\PackageCache\com.csound.csoundunity@6464d3c330\Runtime\CsoundUnity.cs:401 
04-14 14:17:21.805 18703 21977 E Unity   : 

So clearly the libcsoundandroid.so is not deployed or at a different place than expected?

Hi @Eberhard_Schneider and welcome to the forum.
Are you using IL2CPP to build?
It is required since Csound Android is 64 bit only.
In PlayerSettings:


Notice that also x86-64 is supported, it is reported to be working! (haven’t tested it myself because I have no Chrome OS device)

Very glad to be here!
I just switched to IL2CPP and everything seems to work fine!

2 Likes

Great!
Keep us updated with your creations!