3

In a Xamarin Solution, I have:

  • Project 1: An Android application project (application). I had an old Android application using three .so, built as AndroidNativeLibrary. This worked well and .so were found. I wanted to make a library from it. For this reason, I've made a new Library project. Now, in my solution, I have this second project:

  • Project 2: A Library project with .so built as EmbeddedNativeLibrary. This is not working. The DLL doesn't contain the .so nor the .so are copied to the Android application project refering to it. (I don't know what is the usual process to put them in the /lib folder of application during the build process) So the .so libs are just nowhere, Dalvik doesn't find it. I know that it will work if I directly put them in the application project, but this is an ugly solution.

It seems to me that EmbeddedNativeLibrary, judging by the name, should help in my case. But it has no effect.

How can I have my .so files embedded in a .DLL Library or automatically copied in the application /lib directory?

[EDIT]

I should have verified before, but the libs are really included in the APK. They are just not found when running the application. Just like missing or wrongly referenced libraries. Maybe there's an extra step to make them visible?

They are there for the proper ABI

[Mono] DllImport attempting to load: 'libffmpeg.so'.

[Mono] DllImport error loading library '/storage/sdcard0/Android/data/com.pure.ffmpeg/
files/.__override__/libffmpeg.so': 'Cannot load library:
load_library[1093]: Library '/data/data/com.pure.ffmpeg/lib//storage/sdcard0/Android/
data/com.pure.ffmpeg/files/.__override__/libffmpeg.so' not found'.

[Mono] DllImport error loading library
 '/storage/sdcard0/Android/data/com.pure.ffmpeg/files/.__override__/libffmpeg.so': 
'Cannot load library: load_library[1093]: Library '/data/data/com.pure.ffmpeg/
lib//storage/sdcard0/Android/data/com.pure.ffmpeg/files/.__override__/libffmpeg.so'
 not found'.

[Mono] DllImport error loading library 'libffmpeg.so': 
'Cannot load library: 
load_library[1093]: Library '/data/data/com.pure.ffmpeg/lib/libffmpeg.so' not found'.

[Mono] DllImport error loading library 'libffmpeg.so': 'Cannot 
load library: load_library[1093]: Library '/data/data/com.pure.ffmpeg/lib/libffmpeg.so' not found'.

[Mono] DllImport error loading library 'libffmpeg.so': 'Cannot 
load library: load_library[1093]: Library '/data/data/com.pure.ffmpeg/lib/libffmpeg.so' not found'.

[Mono] DllImport unable to load library 'Cannot load library: load_library[1093]: 
Library '/data/data/com.pure.ffmpeg/lib/libffmpeg.so' not found'.
JoshDM
  • 4,939
  • 7
  • 43
  • 72
Léon Pelletier
  • 2,701
  • 2
  • 40
  • 67
  • 1
    Under your Android Build -> Advanced tab, are you building for armeabi or are you building for armeabi-v7a? It looks like you put the library just in the armeabi folder. – chrisntr Jun 08 '15 at 03:33
  • That's what I'm investigating right now. It worked when using it all in an application, but I feel like I have to copy in both arm abi folders when embedding it. – Léon Pelletier Jun 08 '15 at 03:38
  • Oh yeah! You can mark it as an answer. Path sniffing only checks in the abi folder for the current architecture when embedding it. So I copy-pasted it in armeabi-v7a too. – Léon Pelletier Jun 08 '15 at 03:40

1 Answers1

3

Under your Android Build -> Advanced tab, are you building for armeabi or are you building for armeabi-v7a? It looks like you put the library just in the armeabi folder.

chrisntr
  • 2,208
  • 20
  • 28