Author Topic: [Android] Using BASS .NET with Xamarin  (Read 4416 times)

xim

  • Posts: 6
[Android] Using BASS .NET with Xamarin
« on: 20 Feb '14 - 15:14 »
Hello,

I'm trying to use BASS .NET in a Xamarin Android application but I'm having some troubles with configuring my project... I added a reference to Bass.Net.Android,
everything is compiling fine but when I call "Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);" I get the following errors:
DllImport error loading library 'libbass.so': 'dlopen failed: library "/data/data/AndroidApplication1.AndroidApplication1/lib/libbass.so" not found'.
DllImport unable to load library 'dlopen failed: library "/data/data/AndroidApplication1.AndroidApplication1/lib/libbass.so" not found'.

What did I missed?

Thanks for your help

xim

  • Posts: 6
Re: [Android] Using BASS .NET with Xamarin
« Reply #1 on: 21 Feb '14 - 12:46 »
Feel free to share your solution if you succeeded to setup an android application that is using the Bass.Net.Android lib :)

Chris

  • Posts: 1810
Re: [Android] Using BASS .NET with Xamarin
« Reply #2 on: 21 Feb '14 - 13:06 »
does in the lib directory the bass.so file exists?

xim

  • Posts: 6
Re: [Android] Using BASS .NET with Xamarin
« Reply #3 on: 24 Feb '14 - 07:41 »
Nope, I've got a libbass.so from the linux' folder but no bass.so

Chris

  • Posts: 1810
Re: [Android] Using BASS .NET with Xamarin
« Reply #4 on: 24 Feb '14 - 12:33 »
of course i mean libbass.so
Quote
Nope, I've got a libbass.so from the linux' folder
You will need the Android Package and not the Linux Package.
Download

by the way which ARM architecture do you use?
 armeabi or armeabi-v7a ?
Be shure that you copy the right lib from the Android Bass Package.
armeabi BTW armeabi-v7a are different libs.

« Last Edit: 24 Feb '14 - 12:55 by Chris »

xim

  • Posts: 6
Re: [Android] Using BASS .NET with Xamarin
« Reply #5 on: 24 Feb '14 - 13:38 »
My god... I don't know how I possibly missed that. So I added the correct libbass.so as a native android library (from the armeabi-v7a folder) to my project and I now have an exception saying: you are using an unregistered version of BASS.NET ?!

Thank you for your help :)

radio42

  • Posts: 4576
Re: [Android] Using BASS .NET with Xamarin
« Reply #6 on: 24 Feb '14 - 14:28 »
That means  - you are using an unregistered version of Bass.Net ;-)

See here for details:
http://bass.radio42.com/bass_register.html


xim

  • Posts: 6
Re: [Android] Using BASS .NET with Xamarin
« Reply #7 on: 24 Feb '14 - 14:53 »
Yep, I found the link but I'm still waiting for the key! Meanwhile, did I downloaded a wrong version or the Android version doesn't support Broadcasting (via the BroadCast/ICECast classes)?

Thx :)

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: [Android] Using BASS .NET with Xamarin
« Reply #8 on: 24 Feb '14 - 16:16 »
The encoding and casting features are indeed currently unavailable on Android, because the BASSenc add-on isn't currently available. The reason for that is that it uses external encoders (eg. LAME and OGGENC), which aren't available on Android. A way around that could be for BASSenc to support user-provided encoders (similar to user streams in BASS), which would allow the LAME and OGG encoding libraries to be built into an app and used with BASSenc. I'll look into that for the next release.

radio42

  • Posts: 4576
Re: [Android] Using BASS .NET with Xamarin
« Reply #9 on: 25 Feb '14 - 07:51 »
If you 'still' wait for your key you might check your 'Spam' mail filder.
The above site is a self-service site - meaning you provide your data and email address yourself...and then the keys are send to your provided mail address.
So if no mail arrives, you either provided a invalid mail address or the mail landed in your spam folder - in both cases there is not much I can actually do.

xim

  • Posts: 6
Re: [Android] Using BASS .NET with Xamarin
« Reply #10 on: 25 Feb '14 - 07:55 »
All right, thanks for the clarification.

Quote
A way around that could be for BASSenc to support user-provided encoders
That would be really great!

EDIT: mail received yesterday, no worries :)
« Last Edit: 25 Feb '14 - 08:00 by xim »

mediawave

  • Posts: 2
Re: [Android] Using BASS .NET with Xamarin
« Reply #11 on: 14 Apr '14 - 15:29 »
Hi

I am having the same issue in Xamarin Android with libbass.so: DllImport error loading library 'libbass.so'.
The application also uses 'libbass_fx.so' and get the same error for that.

I have added the armeabi-v7a versions of libbass.so & libbass_fx as native android library.
When I look in the created apk file both files are in the lib\armeabi-v7a folder.

I am new to mobile development and Xamarin - am using VS2013 and Xamarin - app running in Emulator for API 10.

From what I have been able to find out on this, Android does not automatically load from the [app name]/lib folder.
Do I have to explicitly load the library from within code? Does Bass.Net.Android not do that ??
If required, how do I explicitly load it?

All help is greatly appreciated.

Thanks

mediawave

  • Posts: 2
Re: [Android] Using BASS .NET with Xamarin
« Reply #12 on: 15 Apr '14 - 09:19 »
I have resolved my issue as above - many thanks to Xamarin tech support.

Should this be of use to anyone else, was resolved by the following:

1. explicitly load the libraries in code as follows:
Java.Lang.JavaSystem.LoadLibrary("bass");
Java.Lang.JavaSystem.LoadLibrary("bass_fx");
I added these to the OnCreate method of the main activity.
Because bass_fx is dependent on bass, you must ensure that bass is loaded first.
Note that "bass" in above method call is mapped to "libbass.so" by the load process.
and similarily "bass_fx" is mapped to "libbass_fx.so"

2. Include the correct versions of the library.
The emulator I tested with required the armeabi versions. In the end I included both armeabi and armeabi-v7a versions in the project and built for both platforms.



brainumbc

  • Posts: 10
Re: [Android] Using BASS .NET with Xamarin
« Reply #13 on: 9 Feb '15 - 20:31 »
I'm struggling with a similar issue. However when I add

Java.Lang.JavaSystem.LoadLibrary("bass");

to the OnCreate method I get:

Java.Lang.LinkageError: Couldn't load bass from loader dalvik.system.PathClassLoader[dexPath=/data/app/TestApp.TestApp-1.apk,libraryPath=/data/app-lib/TestApp.TestApp-1]: findLibrary returned null
  at at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <IL 0x00011, 0x00068>
  at at Android.Runtime.JNIEnv.CallStaticVoidMethod (intptr,intptr,Android.Runtime.JValue[]) <IL 0x00069, 0x00283>
  at at Java.Lang.JavaSystem.LoadLibrary (string) <IL 0x00056, 0x00223>
  at TestApp.MainActivity.OnCreate (Android.OS.Bundle) [0x00016] in c:\Users\brainumbc\Documents\Projects\TestApp\TestApp\MainActivity.cs:21
  at at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) <IL 0x00013, 0x000ef>
  at at (wrapper dynamic-method) object.92815cc3-49de-404f-897c-061ac541deb3 (intptr,intptr,intptr) <IL 0x00017, 0x00043>
  at --- End of managed exception stack trace ---
  at java.lang.UnsatisfiedLinkError: Couldn't load bass from loader dalvik.system.PathClassLoader[dexPath=/data/app/TestApp.TestApp-1.apk,libraryPath=/data/app-lib/TestApp.TestApp-1]: findLibrary returned null
  at at java.lang.Runtime.loadLibrary(Runtime.java:358)
  at at java.lang.System.loadLibrary(System.java:526)
  at at testapp.MainActivity.n_onCreate(Native Method)
  at at testapp.MainActivity.onCreate(MainActivity.java:28)
  at at android.app.Activity.performCreate(Activity.java:5580)
  at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
  at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2487)
  at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2582)
  at at android.app.ActivityThread.access$900(ActivityThread.java:174)
  at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
  at at android.os.Handler.dispatchMessage(Handler.java:102)
  at at android.os.Looper.loop(Looper.java:146)
  at at android.app.ActivityThread.main(ActivityThread.java:5731)
  at at java.lang.reflect.Method.invokeNative(Native Method)
  at at java.lang.reflect.Method.invoke(Method.java:515)
  at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
  at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
  at at dalvik.system.NativeStart.main(Native Method)

brainumbc

  • Posts: 10
Re: [Android] Using BASS .NET with Xamarin
« Reply #14 on: 26 Feb '15 - 19:04 »
Are you still having this problem? If so, let's fire this dicussion up again. I just recently started using Bass.Net for Android and Xamarin. It took almost a month, but I finally got it initialized (it was tricky).

Looking for people with a similar setup to trade ideas with.