Author Topic: using bass library in a .net maui project  (Read 344 times)

Sh3ewit

  • Posts: 3
using bass library in a .net maui project
« on: 17 Sep '23 - 01:28 »
I am trying to use the library in the net Maui android app but after seeing the previous posts about bass in.net maui I still couldn't get it to work,
what I tried: here is the code I used to import the library(libbass.so):
Code: [Select]
#elif __ANDROID__
            NativeLibrary.TryLoad($"{libraryName}.so", assembly, DllImportSearchPath.ApplicationDirectory, out libHandle);
and call it like this:
Code: [Select]
public override void OnCreate()
    {
        base.OnCreate();

        // Load the native library here
       

NativeLibrary.SetDllImportResolver(typeof(BassNet).Assembly, ImportResolver);
       

        // Other initialization code if needed
    }
but still get the dll not found error when initializing bass (DLL not found)
I'm a beginner in Maui if I did anything wrong please let me know,
by the way, you guys did an amazing job on the library totally underrated,
and much thanks and love in advance.

radio42

  • Posts: 4834
Re: using bass library in a .net maui project
« Reply #1 on: 18 Sep '23 - 19:54 »
You pinged me with a PM, that you need help with Bass.Net in your project.
However, I don’t see any Bass.Net code in your example. Instead doubted to load some libs manually ?

So please try to use the Bass.Net core lib with the native Android (Arm) libs.
Samples on how to use Bass.Net are provided in the samples and docs.

If something is not working - just post your sample here.

Sh3ewit

  • Posts: 3
Re: using bass library in a .net maui project
« Reply #2 on: 18 Sep '23 - 22:33 »
i deeply apologize for the inconvenience i was confused of how can I use the library in .net maui, and thank you so much for replaying,
I will do as you say and let you know
tysm again :heart:
« Last Edit: 18 Sep '23 - 23:33 by Sh3ewit »

Sh3ewit

  • Posts: 3
Re: using bass library in a .net maui project
« Reply #3 on: 19 Sep '23 - 01:04 »
After adding the .net core dll files and .so files in the app executable directory like in the attachment,
i still get error when initializing : System.DllNotFoundException: 'bass'

radio42

  • Posts: 4834
Re: using bass library in a .net maui project
« Reply #4 on: 19 Sep '23 - 08:19 »
Where (at which line) do get the mentioned error.
As said, in your above code I can not even spot any Bass.Net code. So please provide that code example here.

Have you tried to provided code sample from the docs?
See here: http://www.bass.radio42.com/help/html/b8b8a713-7af4-465e-a612-1acd769d4639.htm#Using

And use the code provided at My First BASS Application

Ian @ un4seen

  • Administrator
  • Posts: 25626
Re: using bass library in a .net maui project
« Reply #5 on: 19 Sep '23 - 13:17 »
After adding the .net core dll files and .so files in the app executable directory like in the attachment,
i still get error when initializing : System.DllNotFoundException: 'bass'

That looks like it was unable to find the libbass.so file. I'm not at all familiar with .Net on Android, so I'm not sure about that, but in other cases the libraries would be all kept in subdirectories as they are in the BASS ZIP file, eg. in arm64-v8a/armeabi-v7a/etc. This page seems to suggest the same for .Net:

   https://learn.microsoft.com/en-us/xamarin/android/platform/native-libraries