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

Bug Cannot build android project with Accord.net (Unity 2022.3.4f1)

Discussion in 'Editor & General Support' started by Tset_Tsyung, Sep 13, 2023.

  1. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    406
    Hi all,

    We have an android project that we want to build that incorporates ML via the Accord.net framework.

    However, whenever we try to build the android project we get the following error message:

    We used NuGetForUnity to install the necessary packages (Accord.3.8.0, Accord.MachineLearning.3.8.0, Accord.Math.3.8.0 & Accord.Statistics.3.8.0), and have setup a super simple OneClassSupportVectorMachine script for the sake of testing the build process.

    Is this Fixable? Or should I try and use a different library? The problem with the latter path is that Accord gives us the flexibility with regards to future options for different models, statistics and algorithms (our project is still fairly 'young').

    Unfortunately, my understanding of compilation of C/C++/C# code is still fairly limited to the Unity pipeline, so I'm out of my depth here. I'll try and research further, but any and all help in the meantime is greatly apprecited!

    Many thanks all.

    Mike
     
  2. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    406
    Update:

    Still no luck, but following these pages of the manual, I tried setting up a 'link.xml' file with the following contents:

    Code (CSharp):
    1. <linker>
    2.     <assembly fullname="Accord" preseve="all"></assembly>
    3.     <assembly fullname="Accord.Math" preseve="all"></assembly>
    4.     <assembly fullname="Accord.Math.Core preseve="all"></assembly>
    5.    <assembly fullname="Accord.MachineLearning" preseve="all"></assembly>
    6.    <assembly fullname="Accord.Statistics" preseve="all"></assembly>
    7. </linker>
    As stated, this didn't work... but I'm wondering if that's because I missed something... :shrugs

    Again, all thoughts and assistence appreciated.
     
    Last edited: Sep 13, 2023
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
    Is there an integration page for getting Accord to work with Unity?

    Otherwise if it's a recent and current package, odds are that builds of it won't automatically work with Unity.

    Often in this case they will release a version intended for Unity integration, but again, start with their downloads / SDK setup page.
     
  4. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    406
    Hi @Kurt-Dekker

    Yes, there is. However, even following those steps and bypassing the use of NugetForUnity still ends up with the same results, even if using link.xml.

    Have also just confirmed, this also fails in Unity 2021.3.26f1. My research led me to believe that this is a bytecode stripping issue (hence why I was using link.xml), however now I'm not so sure. Any pointers are again appreciated.

    Mike
     
  5. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    406
    @JoshPeterson - Really sorry to tag you in this, but hoping you have some insights I can glean from you...