Author Topic: BASS.NET w/ Xamarin Error: Fatal signal 11 (SIGSEGV)  (Read 3349 times)

brainumbc

  • Posts: 10
So I've got a weird setup here. I'm using C# and Xamarin STudio (and I've had the same problem with the Xamarin plugin for Visual Studio 2013).

So I downloaded the BASS library for Android. I also downloaded and registered the BASS.NET wrapper and added the reference to my project to Bass.Net.Android.

I added the .so file (ARMv7) to the project by adding the following code and dropping the .so file in the bin/Debug directory of my project

  <ItemGroup>
    <AndroidNativeLibrary Include="libbass.so">
      <Abi>armeabi</Abi>
    </AndroidNativeLibrary>
  </ItemGroup>

My code is as follows:

using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Un4seen.Bass;

namespace TestApp
{
   [Activity (Label = "TestApp", MainLauncher = true, Icon = "@drawable/icon")]
   public class MainActivity : Activity
   {
      int count = 1;

      protected override void OnCreate (Bundle bundle)
      {
         base.OnCreate (bundle);
         BassNet.Registration("myemailblabla", "mycode_replacedforthisexample);
         // Set our view from the "main" layout resource
         SetContentView (Resource.Layout.Main);
      
         // Get our button from the layout resource,
         // and attach an event to it
         Button button = FindViewById<Button> (Resource.Id.myButton);
         
         if (Bass.BASS_Init(-1, 44000, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero))
         {

            // create a stream from a file with the option, that it is freed automatically when finished
            int stream = Bass.BASS_StreamCreateFile("78metalb.wav", 0, 0, Un4seen.Bass.BASSFlag.BASS_STREAM_AUTOFREE);
            if (stream != 0)
            {
               button.Click += delegate
               {
                  button.Text = string.Format("{0} clicks!", count++);
                  // if the stream was created, let's play it...
                  Bass.BASS_ChannelPlay(stream, false);
               };

            }

         }

      }
   }
}

When I debug and step through when debugging on my Samsung Galaxy s5 with Android 4.4.2, it crashes on the BASS_Init line and I don't get too much of a helpful error message from either VSTudio or Xamarin studio:

[Mono] DllImport attempting to load: 'libbass.so'.
[Mono] DllImport error loading library '/storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib//storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/libbass.so" not found'.
[Mono] DllImport error loading library '/storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib//storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/libbass.so" not found'.
[Mono] DllImport loaded library 'libbass.so'.
[Mono] DllImport searching in: 'libbass.so' ('libbass.so').
[Mono] Searching for 'BASS_Init'.
[Mono] Probing 'BASS_Init'.
[Mono] Found as 'BASS_Init'.
[Mono] DllImport searching in: 'libbass.so' ('libbass.so').
[Mono] Searching for 'BASS_SetConfig'.
[Mono] Probing 'BASS_SetConfig'.
[Mono] Found as 'BASS_SetConfig'.
[Mono] DllImport searching in: 'libbass.so' ('libbass.so').
[Mono] Searching for 'BASS_GetVersion'.
[Mono] Probing 'BASS_GetVersion'.
[Mono] Found as 'BASS_GetVersion'.
[mono-rt] Stacktrace:
[mono-rt]
[mono-rt]   at <unknown> <0xffffffff>
[mono-rt]   at (wrapper managed-to-native) Un4seen.Bass.Bass.BASS_Init (int,int,Un4seen.Bass.BASSInit,intptr,intptr) <IL 0x0002a, 0xffffffff>
[mono-rt]   at Un4seen.Bass.Bass.BASS_Init (int,int,Un4seen.Bass.BASSInit,intptr) <IL 0x00009, 0x0006f>
[mono-rt]   at TestApp.MainActivity.OnCreate (Android.OS.Bundle) [0x00043] in c:\Users\brainumbc\Documents\Projects\TestApp\TestApp\MainActivity.cs:29
[mono-rt]   at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.App.Activity.cs:2179
[mono-rt]   at (wrapper dynamic-method) object.c7572bcb-0916-4554-8529-0d36e44d6484 (intptr,intptr,intptr) <IL 0x00017, 0x00043>
[mono-rt]   at (wrapper native-to-managed) object.c7572bcb-0916-4554-8529-0d36e44d6484 (intptr,intptr,intptr) <IL 0x00023, 0xffffffff>
[mono-rt]
[mono-rt] =================================================================
[mono-rt] Got a SIGSEGV while executing native code. This usually indicates
[mono-rt] a fatal error in the mono runtime or one of the native libraries
[mono-rt] used by your application.
[mono-rt] =================================================================
[mono-rt]
[libc] Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 5276 (TestApp.TestApp)


...

I'm about to give up with this whole C# thing and just suck it up and learn Java so I can make native apps. Anyone have any idea what the problem might be?

radio42

  • Posts: 4573
Look like you didn't provide the native libbass.so ?

brainumbc

  • Posts: 10
Like I mentioned before, the libbass.so file is in the "bin" (actually the "bin/Debug") folder... the same as the the .apk and other .dll files. I also put the libbass.so file in the same folder as the c# project file.

Is there something else I'm supposed to do with the .so file?

Ian @ un4seen

  • Administrator
  • Posts: 20389
I added the .so file (ARMv7) to the project by adding the following code and dropping the .so file in the bin/Debug directory of my project

  <ItemGroup>
    <AndroidNativeLibrary Include="libbass.so">
      <Abi>armeabi</Abi>
    </AndroidNativeLibrary>
  </ItemGroup>
...

I'm not familiar with Xamarin, but perhaps there should also be an entry for the "armeabi-v7a" architecture? If your device supports ARMv7, then that is probably the one that Android will be looking for.

To confirm whether the BASS library is getting included in your app's package... if you open the APK file in ZIP archiving software, do you see the "libbass.so" file in the "lib/armeabi" and/or "lib/armeabi-v7a" folder?

brainumbc

  • Posts: 10
When I open up the APK in jzip, the lib folder has all three subfolders (armabi,armabi-v7a,x86).

Armabi has
libbass.so
libmono-profider-log.so
libmonodroid.so

Armabiv-7a has
libmono-profiler-log.so
libmonodroid.so

x86 has
libmono-profiler-log.so
libmonodroid.so


Just to be safe, I took the bass so library from the "armabi" folder and used that one instead of v7, dropping it in both the project root and the bin/Debug folder, but still.. the same error.


But that's interesting... the Armabiv7a folder doesn't seem to have the "libbass.so" file. When I downloaded the bass library and extracted it, the "libs" folder had only "libbass.so" inside the armeabi-v7a folder. Here's another strange thing. In the full trace log, I'm getting a lot of "not found" errors like this one towards the top

"[Mono] AOT module 'mscorlib.dll.so' not found: dlopen failed: library "/data/data/TestApp.TestApp/lib/mscorlib.dll.so" not found"

Take a look at the top.

Forwarding debugger port 8849
Detecting existing process
Loaded assembly: /storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/TestApp.dll
Loaded assembly: /storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/Bass.Net.Android.dll [External]
Loaded assembly: Mono.Android.dll [External]
[SELinux] Function: selinux_android_load_priority , priority [3] , priority version is VE=SEPF_SAMSUNG-SM-G870A_4.4.4_0033
[TimaKeyStoreProvider] in addTimaSignatureService
[TimaKeyStoreProvider] Cannot add TimaSignature Service, License check Failed
[monodroid-debug] Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=127.0.0.1:8849,server=y,embedding=1
[libc] WARNING: generic atexit() called from legacy shared library
[Mono] Image addref mscorlib[0x7313d8e0] -> mscorlib.dll[0x731ac230]: 1
[Mono] AOT module 'mscorlib.dll.so' not found: dlopen failed: library "/data/data/TestApp.TestApp/lib/mscorlib.dll.so" not found
[Mono] Assembly mscorlib[0x7313d8e0] added to domain RootDomain, ref_count=1
[Mono] Assembly Loader probing location: '/storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/TestApp.dll'.
[Mono] Image addref TestApp[0x779ce7f0] -> /storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/TestApp.dll[0x779cdbc0]: 2
[Mono] Assembly TestApp[0x779ce7f0] added to domain RootDomain, ref_count=1
[Mono] AOT module '/storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/TestApp.dll.so' not found: dlopen failed: library "/data/data/TestApp.TestApp/lib//storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/TestApp.dll.so" not found
[Mono] Assembly Loader loaded assembly from location: '/storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/TestApp.dll'.
[Mono] Config attempting to parse: '/storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/TestApp.dll.config'.
[Mono] Config attempting to parse: '/Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/builds/install/mono-armv7/etc/mono/assemblies/TestApp/TestApp.config'.
[Mono] Assembly Loader probing location: '/storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/Bass.Net.Android.dll'.
[Mono] Image addref Bass.Net.Android[0x77be17c0] -> /storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/Bass.Net.Android.dll[0x779d2b50]: 2
[Mono] Assembly Bass.Net.Android[0x77be17c0] added to domain RootDomain, ref_count=1
[Mono] AOT module '/storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/Bass.Net.Android.dll.so' not found: dlopen failed: library "/data/data/TestApp.TestApp/lib//storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/Bass.Net.Android.dll.so" not found
[Mono] Assembly Loader loaded assembly from location: '/storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/Bass.Net.Android.dll'.
[Mono] Config attempting to parse: '/storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/Bass.Net.Android.dll.config'.
[Mono] Config attempting to parse: '/Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/builds/install/mono-armv7/etc/mono/assemblies/Bass.Net.Android/Bass.Net.Android.config'.
[monodroid-gc] GREF GC Threshold: 46800
[Mono] Image addref Mono.Android[0x77be6528] -> Mono.Android.dll[0x77be5968]: 1
[Mono] Assembly Mono.Android[0x77be6528] added to domain RootDomain, ref_count=1
[Mono] AOT module 'Mono.Android.dll.so' not found: dlopen failed: library "/data/data/TestApp.TestApp/lib/Mono.Android.dll.so" not found
[Mono] Assembly Ref addref Mono.Android[0x77be6528] -> mscorlib[0x7313d8e0]: 2
[monodroid] Xamarin/Android Trial Mode Active
[Activity] #1 setTransGradationModeColor false
[Adreno-EGL] <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build:  ()
[Adreno-EGL] OpenGL ES Shader Compiler Version: E031.24.00.08+13
[Adreno-EGL] Build Date: 03/28/14 Fri
[Adreno-EGL] Local Branch: 0328_AU200_patches
[Adreno-EGL] Remote Branch:
[Adreno-EGL] Local Patches:
[Adreno-EGL] Reconstruct Branch:
[HWUI] EGLImpl-HWUI Protected EGL context created
[OpenGLRenderer] Enabling debug mode 0
[Mono] Image addref System.Core[0x7d84f730] -> System.Core.dll[0x7d8a2e18]: 1
[Mono] Assembly System.Core[0x7d84f730] added to domain RootDomain, ref_count=1
[Mono] AOT module 'System.Core.dll.so' not found: dlopen failed: library "/data/data/TestApp.TestApp/lib/System.Core.dll.so" not found
[Mono] Assembly Ref addref Mono.Android[0x77be6528] -> System.Core[0x7d84f730]: 2
[Mono] Assembly Ref addref System.Core[0x7d84f730] -> mscorlib[0x7313d8e0]: 3
Loaded assembly: System.Core.dll [External]
[Mono] Assembly Ref addref TestApp[0x779ce7f0] -> Mono.Android[0x77be6528]: 2
[Mono] DllImport attempting to load: '__Internal'.
[Mono] DllImport loaded library '(null)'.
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for '_monodroid_gc_wait_for_bridge_processing'.
[Mono] Probing '_monodroid_gc_wait_for_bridge_processing'.
[Mono] Found as '_monodroid_gc_wait_for_bridge_processing'.
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for '_monodroid_get_identity_hash_code'.
[Mono] Probing '_monodroid_get_identity_hash_code'.
[Mono] Found as '_monodroid_get_identity_hash_code'.
Loaded assembly: MonoDroidConstructors [External]
[Mono] Assembly Ref addref TestApp[0x779ce7f0] -> mscorlib[0x7313d8e0]: 4
Resolved pending breakpoint at 'c:\Users\brainumbc\Documents\Projects\TestApp\TestApp\MainActivity.cs:32,1' to void TestApp.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x0006b].
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for '_monodroid_gref_log_new'.
[Mono] Probing '_monodroid_gref_log_new'.
[Mono] Found as '_monodroid_gref_log_new'.
[Mono] Assembly Ref addref TestApp[0x779ce7f0] -> Bass.Net.Android[0x77be17c0]: 2
[Mono] The request to load the assembly mscorlib v3.5.0.0 was remapped to v2.0.5.0
[Mono] Unloading image mscorlib.dll [0x7e9488f8].
[Mono] Assembly Ref addref Bass.Net.Android[0x77be17c0] -> mscorlib[0x7313d8e0]: 5
[MoreInfoHPW_View] Parent view is not a TextView
[Mono] DllImport attempting to load: 'libbass.so'.
[Mono] DllImport error loading library '/storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib//storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/libbass.so" not found'.
[Mono] DllImport error loading library '/storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib//storage/emulated/0/Android/data/TestApp.TestApp/files/.__override__/libbass.so" not found'.
[Mono] DllImport loaded library 'libbass.so'.
[Mono] DllImport searching in: 'libbass.so' ('libbass.so').
[Mono] Searching for 'BASS_Init'.
[Mono] Probing 'BASS_Init'.
[Mono] Found as 'BASS_Init'.
[Mono] DllImport searching in: 'libbass.so' ('libbass.so').
[Mono] Searching for 'BASS_SetConfig'.
[Mono] Probing 'BASS_SetConfig'.
[Mono] Found as 'BASS_SetConfig'.
[Mono] DllImport searching in: 'libbass.so' ('libbass.so').
[Mono] Searching for 'BASS_GetVersion'.
[Mono] Probing 'BASS_GetVersion'.
[Mono] Found as 'BASS_GetVersion'.
[mono-rt] Stacktrace:
[mono-rt]
[mono-rt]   at <unknown> <0xffffffff>
[mono-rt]   at (wrapper managed-to-native) Un4seen.Bass.Bass.BASS_Init (int,int,Un4seen.Bass.BASSInit,intptr,intptr) <IL 0x0002a, 0xffffffff>
[mono-rt]   at Un4seen.Bass.Bass.BASS_Init (int,int,Un4seen.Bass.BASSInit,intptr) <IL 0x00009, 0x0006f>
[mono-rt]   at TestApp.MainActivity.OnCreate (Android.OS.Bundle) [0x00043] in c:\Users\brainumbc\Documents\Projects\TestApp\TestApp\MainActivity.cs:28
[mono-rt]   at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.App.Activity.cs:2179
[mono-rt]   at (wrapper dynamic-method) object.7a2af970-7515-4862-ae88-b2756ac0cd33 (intptr,intptr,intptr) <IL 0x00017, 0x00043>
[mono-rt]   at (wrapper native-to-managed) object.7a2af970-7515-4862-ae88-b2756ac0cd33 (intptr,intptr,intptr) <IL 0x00023, 0xffffffff>
[mono-rt]
[mono-rt] =================================================================
[mono-rt] Got a SIGSEGV while executing native code. This usually indicates
[mono-rt] a fatal error in the mono runtime or one of the native libraries
[mono-rt] used by your application.
[mono-rt] =================================================================
[mono-rt]
[libc] Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 26001 (TestApp.TestApp)



brainumbc

  • Posts: 10
Interesting. So I played around with the project build configuration in Xamarin and managed to get past it crashing. Now I guess I actually get an error:

System.TypeInitializationException: An exception was thrown by the type initializer for Un4seen.Bass.Bass ---> System.Exception: libbass.so
  at at (wrapper managed-to-native) Un4seen.Bass.Bass:BASS_SetConfig (Un4seen.Bass.BASSConfig,int)
  at Un4seen.Bass.Bass.b () [0x00000] in <filename unknown>:0
  at Un4seen.Bass.Bass..cctor () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
 
The line is just this:

if (Bass.BASS_Init(-1, 44000, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero))

it's pretty much

Does that make any sense? In fact the application output log looks a little more detailed now:

Forwarding debugger port 8896
Detecting existing process
Loaded assembly: TestApp.dll
Loaded assembly: Bass.Net.Android.dll [External]
Loaded assembly: Mono.Android.dll [External]
[SELinux] Function: selinux_android_load_priority , priority [3] , priority version is VE=SEPF_SAMSUNG-SM-G870A_4.4.4_0033
[TimaKeyStoreProvider] in addTimaSignatureService
[TimaKeyStoreProvider] Cannot add TimaSignature Service, License check Failed
[monodroid-debug] Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=127.0.0.1:8896,server=y,embedding=1
[libc] WARNING: generic atexit() called from legacy shared library
[Mono] Image addref mscorlib[0x7313b2b8] -> mscorlib.dll[0x7314f590]: 1
[Mono] AOT module 'mscorlib.dll.so' not found: dlopen failed: library "/data/data/TestApp.TestApp/lib/mscorlib.dll.so" not found
[Mono] Assembly mscorlib[0x7313b2b8] added to domain RootDomain, ref_count=1
[Mono] Image addref TestApp[0x7889f678] -> TestApp.dll[0x7889eb40]: 1
[Mono] Assembly TestApp[0x7889f678] added to domain RootDomain, ref_count=1
[Mono] AOT module 'TestApp.dll.so' not found: dlopen failed: library "/data/data/TestApp.TestApp/lib/TestApp.dll.so" not found
[Mono] Image addref Bass.Net.Android[0x788a49e0] -> Bass.Net.Android.dll[0x788a3dc8]: 1
[Mono] Assembly Bass.Net.Android[0x788a49e0] added to domain RootDomain, ref_count=1
[Mono] AOT module 'Bass.Net.Android.dll.so' not found: dlopen failed: library "/data/data/TestApp.TestApp/lib/Bass.Net.Android.dll.so" not found
[monodroid-gc] GREF GC Threshold: 46800
[Mono] Image addref Mono.Android[0x78ab57d0] -> Mono.Android.dll[0x788a4b90]: 1
[Mono] Assembly Mono.Android[0x78ab57d0] added to domain RootDomain, ref_count=1
[Mono] AOT module 'Mono.Android.dll.so' not found: dlopen failed: library "/data/data/TestApp.TestApp/lib/Mono.Android.dll.so" not found
[Mono] Assembly Ref addref Mono.Android[0x78ab57d0] -> mscorlib[0x7313b2b8]: 2
[monodroid] Xamarin/Android Trial Mode Active
[Activity] #1 setTransGradationModeColor false
[Adreno-EGL] <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build:  ()
[Adreno-EGL] OpenGL ES Shader Compiler Version: E031.24.00.08+13
[Adreno-EGL] Build Date: 03/28/14 Fri
[Adreno-EGL] Local Branch: 0328_AU200_patches
[Adreno-EGL] Remote Branch:
[Adreno-EGL] Local Patches:
[Adreno-EGL] Reconstruct Branch:
[HWUI] EGLImpl-HWUI Protected EGL context created
[OpenGLRenderer] Enabling debug mode 0
Loaded assembly: System.Core.dll [External]
[Mono] Image addref System.Core[0x7a6e5008] -> System.Core.dll[0x7a6bdc50]: 1
[Mono] Assembly System.Core[0x7a6e5008] added to domain RootDomain, ref_count=1
[Mono] AOT module 'System.Core.dll.so' not found: dlopen failed: library "/data/data/TestApp.TestApp/lib/System.Core.dll.so" not found
[Mono] Assembly Ref addref Mono.Android[0x78ab57d0] -> System.Core[0x7a6e5008]: 2
[Mono] Assembly Ref addref System.Core[0x7a6e5008] -> mscorlib[0x7313b2b8]: 3
[Mono] Assembly Ref addref TestApp[0x7889f678] -> Mono.Android[0x78ab57d0]: 2
[Mono] DllImport attempting to load: '__Internal'.
[Mono] DllImport loaded library '(null)'.
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for '_monodroid_gc_wait_for_bridge_processing'.
[Mono] Probing '_monodroid_gc_wait_for_bridge_processing'.
[Mono] Found as '_monodroid_gc_wait_for_bridge_processing'.
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for '_monodroid_get_identity_hash_code'.
[Mono] Probing '_monodroid_get_identity_hash_code'.
[Mono] Found as '_monodroid_get_identity_hash_code'.
Loaded assembly: MonoDroidConstructors [External]
[Mono] Assembly Ref addref TestApp[0x7889f678] -> mscorlib[0x7313b2b8]: 4
Resolved pending breakpoint at 'c:\Users\brainumbc\Documents\Projects\TestApp\TestApp\MainActivity.cs:33,1' to void TestApp.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x0006b].
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for '_monodroid_gref_log_new'.
[Mono] Probing '_monodroid_gref_log_new'.
[Mono] Found as '_monodroid_gref_log_new'.
[Mono] Assembly Ref addref TestApp[0x7889f678] -> Bass.Net.Android[0x788a49e0]: 2
[Mono] The request to load the assembly mscorlib v3.5.0.0 was remapped to v2.0.5.0
[Mono] Unloading image mscorlib.dll [0x78ad29e8].
[Mono] Assembly Ref addref Bass.Net.Android[0x788a49e0] -> mscorlib[0x7313b2b8]: 5
[MoreInfoHPW_View] Parent view is not a TextView
[Mono] DllImport attempting to load: 'libbass.so'.
[Mono] DllImport error loading library './libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/./libbass.so" not found'.
[Mono] DllImport error loading library './libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/./libbass.so" not found'.
[Mono] DllImport error loading library 'libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.
[Mono] DllImport error loading library 'libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.
[Mono] DllImport error loading library 'libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.
[Mono] DllImport unable to load library 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.
[Mono] DllImport attempting to load: 'libbass.so'.
[Mono] DllImport error loading library './libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/./libbass.so" not found'.
[Mono] DllImport error loading library './libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/./libbass.so" not found'.
[Mono] DllImport error loading library 'libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.
[Mono] DllImport error loading library 'libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.
[Mono] DllImport error loading library 'libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.
[Mono] DllImport unable to load library 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.
[Mono] DllImport attempting to load: 'libbass.so'.
[Mono] DllImport error loading library './libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/./libbass.so" not found'.
[Mono] DllImport error loading library './libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/./libbass.so" not found'.
[Mono] DllImport error loading library 'libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.
[Mono] DllImport error loading library 'libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.
[Mono] DllImport error loading library 'libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.
[Mono] DllImport unable to load library 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.
[Mono] DllImport attempting to load: 'libbass.so'.
[Mono] DllImport error loading library './libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/./libbass.so" not found'.
[Mono] DllImport error loading library './libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/./libbass.so" not found'.
[Mono] DllImport error loading library 'libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.
[Mono] DllImport error loading library 'libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.
[Mono] DllImport error loading library 'libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.
[Mono] DllImport unable to load library 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.
[Mono] DllImport attempting to load: 'libbass.so'.
[Mono] DllImport error loading library './libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/./libbass.so" not found'.
[Mono] DllImport error loading library './libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/./libbass.so" not found'.
[Mono] DllImport error loading library 'libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.
[Mono] DllImport error loading library 'libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.
[Mono] DllImport error loading library 'libbass.so': 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.
[Mono] DllImport unable to load library 'dlopen failed: library "/data/data/TestApp.TestApp/lib/libbass.so" not found'.

brainumbc

  • Posts: 10
FYI I just found this article

http://www.un4seen.com/forum/?topic=15568.0

Someone else had a very similar issue and they said they just explicitly loaded the library. It worked for them, but I just get this error:

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

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS.NET w/ Xamarin Error: Fatal signal 11 (SIGSEGV)
« Reply #7 on: 10 Feb '15 - 14:06 »
When I open up the APK in jzip, the lib folder has all three subfolders (armabi,armabi-v7a,x86).

Armabi has
libbass.so
libmono-profider-log.so
libmonodroid.so

Armabiv-7a has
libmono-profiler-log.so
libmonodroid.so

x86 has
libmono-profiler-log.so
libmonodroid.so


Just to be safe, I took the bass so library from the "armabi" folder and used that one instead of v7, dropping it in both the project root and the bin/Debug folder, but still.. the same error.


But that's interesting... the Armabiv7a folder doesn't seem to have the "libbass.so" file.

Yes, that seems to confirm that the problem is that the "armeabi-v7a" BASS library version is missing from your app. As I say, I'm not familiar with Xamarin, but the documentation suggests that if you leave the BASS libraries in the same directory structure as in the BASS package (ie. in the "libs" directory), then you should be able to simply add them all to your project due to "path sniffing"...

   http://developer.xamarin.com/guides/android/advanced_topics/using_native_libraries/

When I downloaded the bass library and extracted it, the "libs" folder had only "libbass.so" inside the armeabi-v7a folder.

That's strange. Where did you download the BASS library from? You can get the full package from this forum thread...

   www.un4seen.com/forum/?topic=13225

brainumbc

  • Posts: 10
Re: BASS.NET w/ Xamarin Error: Fatal signal 11 (SIGSEGV)
« Reply #8 on: 10 Feb '15 - 15:33 »
Well the problem seems to be narrowed down to the fact that the .so's aren't being included in the APK lib's folder, so thank you for that help. Now I just have to figure out why. The APK's are automatically built for me in Xamarin Studio so I don't seem to have any control over how they're created or how the lib folders get populated in there...

I'll poke around and see what I can find.

As to your other question, I downloaded BASS for android about a week ago. When i download it:

http://www.un4seen.com/stuff/bass24-android.zip

And open it up, there are many folders (e.g. bassenc, bassflac, etc). For now I just want the most basic features so I'm going straight to the "lib" folder in the root. In the armabi, armabi-7va, and x86 there is only one file in each named "libbass.so". Give it a try yourself. Open up that zip, go straight to the LIB folder and look in the three folders. You'll only see "libbass.so" in each one.

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS.NET w/ Xamarin Error: Fatal signal 11 (SIGSEGV)
« Reply #9 on: 10 Feb '15 - 16:14 »
And open it up, there are many folders (e.g. bassenc, bassflac, etc). For now I just want the most basic features so I'm going straight to the "lib" folder in the root. In the armabi, armabi-7va, and x86 there is only one file in each named "libbass.so". Give it a try yourself. Open up that zip, go straight to the LIB folder and look in the three folders. You'll only see "libbass.so" in each one.

Yes, that is correct. Libraries should have the same filename for all architectures (eg. see the "libmonodroid.so" entries in your previous post), but the content of each is different, ie. they use different instruction sets. You need to leave the "libbass.so" files in the same directory structure as they are in the BASS package, ie. extract the "libs" directory as is and then add the libraries in it to your project; the "path sniffing" should take care of the rest.

brainumbc

  • Posts: 10
Re: BASS.NET w/ Xamarin Error: Fatal signal 11 (SIGSEGV)
« Reply #10 on: 11 Feb '15 - 22:37 »
BOOOYAW! Found the problem. In Xamarin you don't put the .so file in the bin/Debug or project root folder. You have to make sure the .so files are in the ASSETS folder of your project. Adding a screenshot for reference for anyone in the future who has this problem.

Now I'm not able to create a stream.. getting a value of 0 for this

int stream = Bass.BASS_StreamCreateFile("78metalb.wav", 0, 0, Un4seen.Bass.BASSFlag.BASS_STREAM_AUTOFREE);

BUT that's a whole other story. At least that isn't an error and it means that BASS for Android is actually working with the BASS.NET wrapper in Xamarin Studio. Not sure if the wav file needs to exist in the project itself on my PC or if it needs to exist somewhere in my Android device.

WOOHOOO! Finally over the hurdle!

Here are some other things to note:

* YES, the other post was correct: The line "Java.Lang.JavaSystem.LoadLibrary("bass");" *IS* most definitely needed before you call any Bass methods.
* According to BASS.NET's site, in addition to the Bass.Net.Android.dll file, the Bass.bll file also has to exist in the bin/Debug folder. This does NOT seem to be the case. I took the libbass.so and bass.dll files out of the bin/Debug folder and it didn't crash when I called Bass_Init
* According to Xamarin's documentation, the .so file has to be referenced in the csproj file. So the following code needs to be in your csproj file:
<ItemGroup>
    <AndroidNativeLibrary Include="libbass.so">
      <Abi>armeabi</Abi>
    </AndroidNativeLibrary>
  </ItemGroup>
The libbass.so needs to be in the project root. Althrough you could probably put the .so file anywhere as long as the Include attribute points to it properly.





So if I'm using Xamarin or any other IDE, any idea why I would get a "0" value for:
Bass.BASS_StreamCreateFile("78metalb.wav", 0, 0, Un4seen.Bass.BASSFlag.BASS_STREAM_AUTOFREE);

Does the physical wav file have to exist somewhere on the Android device somewhere? I thought by adding the wav file to the Assets folder in my project as well as the bin/Debug folder then it would work. Ultimately instead of actual wav files I plan on using a binary stream that I get from a microsoft sql server FILESTREAM field, but before I get all crazy with the database connections, I'd like to make sure I can get the basic I/O working first.

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS.NET w/ Xamarin Error: Fatal signal 11 (SIGSEGV)
« Reply #11 on: 13 Feb '15 - 18:04 »
Good to hear you have got things working now. Regarding assets, I don't think it's possible to access them directly as files. Android provides an "AssetManager" Java class to access them, and BASS provides an "Asset" class to wrap that stuff, but I'm not sure whether that can be applied to .Net/Xamarin; I would guess not. Xamarin probably has its own asset access methods? If you don't actually need assets and just want to test playback, you could put the test files in the device's internal storage space or SD card instead.

Fabio

  • Posts: 3
Re: BASS.NET w/ Xamarin Error: Fatal signal 11 (SIGSEGV)
« Reply #12 on: 14 Oct '17 - 10:56 »
Hi,
I'm trying to create a xamarin forms application to play radio streaming  in .aac format and I'm using the BASS.NET player in the android project and I obtain your same issue.
I installed via NuGet the following packages in the android project: Bass.NetWrapper, BASS.ASIO, BASS.Native and now the android project has the reference to Bass.Net.Android.
 
The code I wrote is the following:

BassNet.Registration(radioSettings.BassRegistrationEmail, radioSettings.BassRegistrationKey);             
Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
int stream = Bass.BASS_StreamCreateFile(radioSettings.Mp3StreamingPath, 0, 0, BASSFlag.BASS_DEFAULT);

The call of Bass.BASS_Init generates an exception with:
message =  {System.TypeInitializationException: The type initializer for 'Un4seen.Bass.Bass' threw an exception. ---> System.DllNotFoundException: bass
  at (wrapper managed-to-native) Un4seen.Bass.Bass:BASS_SetConfig (Un4seen.Bass.BASSConfig,int)
  at Un4seen.Bass.Bass.InitBass () [0x0000c] in <1dccb519ae934f21888f2d5573071ce2>:0
  at Un4seen.Bass.Bass..cctor () [0x0004b] in <1dccb519ae934f21888f2d5573071ce2>:0
   --- End of inner exception stack trace ---
  at RLT.Droid.DataAccessLayer.RadioStreamingDataAccess.AacPlayPauseStreaming (DataAccessModel.Model.RadioSettingsDataModel radioSettings) [0x0001a] in C:\Users\Claudio\documents\visual studio 2017\Projects\RLT\RLT\RLT.Android\DataAccessLayer\RadioStreamingDataAccess.cs:188 }

I understand that the native library for android is missing, so I downloaded the file from the link  www.un4seen.com/stuff/bass24-android.zip and I followed your instructions.
I put the
<ItemGroup>
    <AndroidNativeLibrary Include="libbass.so">
      <Abi>armeabi</Abi>
    </AndroidNativeLibrary>
  </ItemGroup>
in the .csproj, I put the file libbass.so in the root of the android project and in the bin/Debug folder and i wrote this code.

Java.Lang.JavaSystem.LoadLibrary("bass");
BassNet.Registration(radioSettings.BassRegistrationEmail, radioSettings.BassRegistrationKey);
Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);

But the line Java.Lang.JavaSystem.LoadLibrary("bass"); generate the exception:

{Java.Lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/RLT.Android-1/base.apk"],nativeLibraryDirectories=[/data/app/RLT.Android-1/lib/x86, /data/app/RLT.Android-1/base.apk!/lib/x86, /vendor/lib, /system/lib]]] couldn't find "libbass.so"
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <3fd174ff54b146228c505f23cf75ce71>:0
  at Java.Interop.JniEnvironment+StaticMethods.CallStaticVoidMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <bd30a18775d94dc8b6263aecd1ca9077>:0
  at Java.Interop.JniPeerMembers+JniStaticMethods.InvokeVoidMethod (System.String encodedMember, Java.Interop.JniArgumentValue* parameters) [0x00018] in <bd30a18775d94dc8b6263aecd1ca9077>:0
  at Java.Lang.JavaSystem.LoadLibrary (System.String libName) [0x00029] in <9ab9faae1b4b4f0da28e7c4ac61e2c78>:0
  at RLT.Droid.DataAccessLayer.RadioStreamingDataAccess.AacPlayPauseStreaming (DataAccessModel.Model.RadioSettingsDataModel radioSettings) [0x00008] in C:\Users\Claudio\documents\visual studio 2017\Projects\RLT\RLT\RLT.Android\DataAccessLayer\RadioStreamingDataAccess.cs:184
  --- End of managed Java.Lang.UnsatisfiedLinkError stack trace ---
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/RLT.Android-1/base.apk"],nativeLibraryDirectories=[/data/app/RLT.Android-1/lib/x86, /data/app/RLT.Android-1/base.apk!/lib/x86, /vendor/lib, /system/lib]]] couldn't find "libbass.so"
   at java.lang.Runtime.loadLibrary(Runtime.java:367)
   at java.lang.System.loadLibrary(System.java:1076)
   at md5270abb39e60627f0f200893b490a1ade.ButtonRenderer_ButtonClickListener.n_onClick(Native Method)
   at md5270abb39e60627f0f200893b490a1ade.ButtonRenderer_ButtonClickListener.onClick(ButtonRenderer_ButtonClickListener.java:30)
   at android.view.View.performClick(View.java:5198)
   at android.view.View$PerformClick.run(View.java:21147)
   at android.os.Handler.handleCallback(Handler.java:739)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:148)
   at android.app.ActivityThread.main(ActivityThread.java:5417)
   at java.lang.reflect.Method.invoke(Native Method)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
}

What step I skip?
I attached an image with the structure of my solution.


Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS.NET w/ Xamarin Error: Fatal signal 11 (SIGSEGV)
« Reply #13 on: 16 Oct '17 - 13:14 »
That looks like it can't find the libbass.so file. If you open your app's APK file in ZIP software, do you see a libbass.so file in lib/armeabi, lib/armeabi-v7a, lib/x86 folders?

Fabio

  • Posts: 3
Re: BASS.NET w/ Xamarin Error: Fatal signal 11 (SIGSEGV)
« Reply #14 on: 18 Oct '17 - 20:00 »
I solved the problem as follow:
1) Download the native libraries for android from the link  www.un4seen.com/stuff/bass24-android.zip;
2) Unzip the file and put the libs folder in the root of your android project;
3) In the MainActivity.cs you must write the line "Java.Lang.JavaSystem.LoadLibrary("bass");" in the method OnCreate;
4) In the AppName.Android.csproj write the follow lines

<ItemGroup>
    <AndroidNativeLibrary Include="libs\armeabi-v7a\libbass.so" >
      <Abi>armeabi-v7a</Abi>
    </AndroidNativeLibrary>
    <AndroidNativeLibrary Include="libs\armeabi\libbass.so" >
      <Abi>armeabi</Abi>
    </AndroidNativeLibrary>
    <AndroidNativeLibrary Include="libs\x86\libbass.so" >
      <Abi>x86</Abi>
    </AndroidNativeLibrary>
  </ItemGroup>

This works for me.