[Mono-dev] Using .so file in Android Library Project and then using it in an Android App

Burhan Eyuboglu burhaneyuboglu at gmail.com
Wed Nov 26 16:08:23 UTC 2014


I have created a lib file in the resources folder, and armeabi-v7a folder
in the lib file and put the libcyusb.so there. When I look at the csproj
file, it has changed like that:

<ItemGroup>
    <AndroidEmbeddedJavaLibrary
Include="Resources\lib\armeabi-v7a\libcyusb.so" />


However, I'm still getting " can not load dll" error:

[monodroid-debug] Trying to initialize the debugger with options:
--debugger-agent=transport=dt_socket,loglevel=0,address=127.0.0.1:8852
,server=y,embedding=1
[libc] WARNING: generic atexit() called from legacy shared library
[Mono] Image addref mscorlib[0x5ac6bfe0] -> mscorlib.dll[0x5ace0fa0]: 1
[Mono] AOT module 'mscorlib.dll.so' not found: Cannot load library:
load_library(linker.cpp:746): library
"/data/data/LibraryDenemesi.LibraryDenemesi/lib/mscorlib.dll.so" not found
[Mono] Assembly mscorlib[0x5ac6bfe0] added to domain RootDomain, ref_count=1
[Mono] Assembly Loader probing location:
'/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/LibraryDenemesi.dll'.
[Mono] Image addref LibraryDenemesi[0x5c771638] ->
/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/LibraryDenemesi.dll[0x5bb190f0]:
2
[Mono] Assembly LibraryDenemesi[0x5c771638] added to domain RootDomain,
ref_count=1
[Mono] AOT module
'/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/
LibraryDenemesi.dll.so' not found: Cannot load library:
load_library(linker.cpp:746): library
"/data/data/LibraryDenemesi.LibraryDenemesi/lib//storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/
LibraryDenemesi.dll.so" not found
[Mono] Assembly Loader loaded assembly from location:
'/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/LibraryDenemesi.dll'.
[Mono] Config attempting to parse:
'/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/LibraryDenemesi.dll.config'.
[Mono] Config attempting to parse:
'/Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/builds/install/mono-armv7/etc/mono/assemblies/LibraryDenemesi/LibraryDenemesi.config'.
[Mono] Image addref CypressLibrary[0x5ac25fb0] ->
CypressLibrary.dll[0x5bb1a420]: 1
[Mono] Assembly CypressLibrary[0x5ac25fb0] added to domain RootDomain,
ref_count=1
[Mono] AOT module 'CypressLibrary.dll.so' not found: Cannot load library:
load_library(linker.cpp:746): library
"/data/data/LibraryDenemesi.LibraryDenemesi/lib/CypressLibrary.dll.so" not
found
[monodroid-gc] GREF GC Threshold: 46800
[Mono] Image addref Mono.Android[0x5aa93670] ->
Mono.Android.dll[0x5ace36c8]: 1
[Mono] Assembly Mono.Android[0x5aa93670] added to domain RootDomain,
ref_count=1
[Mono] AOT module 'Mono.Android.dll.so' not found: Cannot load library:
load_library(linker.cpp:746): library
"/data/data/LibraryDenemesi.LibraryDenemesi/lib/Mono.Android.dll.so" not
found
[Mono] Assembly Ref addref Mono.Android[0x5aa93670] ->
mscorlib[0x5ac6bfe0]: 2
[Mono] Image addref System.Core[0x5aceeb28] -> System.Core.dll[0x59bb3240]:
1
[Mono] Assembly System.Core[0x5aceeb28] added to domain RootDomain,
ref_count=1
[Mono] AOT module 'System.Core.dll.so' not found: Cannot load library:
load_library(linker.cpp:746): library
"/data/data/LibraryDenemesi.LibraryDenemesi/lib/System.Core.dll.so" not
found
[Mono] Assembly Ref addref Mono.Android[0x5aa93670] ->
System.Core[0x5aceeb28]: 2
[Mono] Assembly Ref addref System.Core[0x5aceeb28] -> mscorlib[0x5ac6bfe0]:
3
[Mono] Assembly Ref addref LibraryDenemesi[0x5c771638] ->
Mono.Android[0x5aa93670]: 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 LibraryDenemesi[0x5c771638] ->
mscorlib[0x5ac6bfe0]: 4
[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 Loader probing location:
'/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/CypressDenemeLibrary.dll'.
[Mono] Image addref CypressDenemeLibrary[0x5f6dd4f8] ->
/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/CypressDenemeLibrary.dll[0x5f6dd150]:
2
[Mono] Assembly CypressDenemeLibrary[0x5f6dd4f8] added to domain
RootDomain, ref_count=1
[Mono] AOT module
'/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/
CypressDenemeLibrary.dll.so' not found: Cannot load library:
load_library(linker.cpp:746): library
"/data/data/LibraryDenemesi.LibraryDenemesi/lib//storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/
CypressDenemeLibrary.dll.so" not found
[Mono] Assembly Loader loaded assembly from location:
'/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/CypressDenemeLibrary.dll'.
[Mono] Config attempting to parse:
'/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/CypressDenemeLibrary.dll.config'.
[Mono] Config attempting to parse:
'/Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/builds/install/mono-armv7/etc/mono/assemblies/CypressDenemeLibrary/CypressDenemeLibrary.config'.
[Mono] Assembly Ref addref LibraryDenemesi[0x5c771638] ->
CypressDenemeLibrary[0x5f6dd4f8]: 2
[Mono] Assembly Ref addref CypressDenemeLibrary[0x5f6dd4f8] ->
mscorlib[0x5ac6bfe0]: 5
[Mono] DllImport attempting to load: 'libcyusb.so'.
[Mono] DllImport error loading library
'/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/libcyusb.so':
'Cannot load library: load_library(linker.cpp:746): library
"/data/data/LibraryDenemesi.LibraryDenemesi/lib//storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/libcyusb.so"
not found'.
[Mono] DllImport error loading library
'/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/libcyusb.so':
'Cannot load library: load_library(linker.cpp:746): library
"/data/data/LibraryDenemesi.LibraryDenemesi/lib//storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/libcyusb.so"
not found'.
[Mono] DllImport error loading library 'libcyusb.so': 'Cannot load library:
load_library(linker.cpp:746): library
"/data/data/LibraryDenemesi.LibraryDenemesi/lib/libcyusb.so" not found'.
[Mono] DllImport error loading library 'libcyusb.so': 'Cannot load library:
load_library(linker.cpp:746): library
"/data/data/LibraryDenemesi.LibraryDenemesi/lib/libcyusb.so" not found'.
[Mono] DllImport error loading library 'libcyusb.so': 'Cannot load library:
load_library(linker.cpp:746): library
"/data/data/LibraryDenemesi.LibraryDenemesi/lib/libcyusb.so" not found'.
[Mono] DllImport unable to load library 'Cannot load library:
load_library(linker.cpp:746): library
"/data/data/LibraryDenemesi.LibraryDenemesi/lib/libcyusb.so" not found'.
Loaded assembly:
/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/CypressDenemeLibrary.dll
[External]
[MoreInfoHPW_ViewGroup] Parent view is not a TextView
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for '_monodroid_gref_log_delete'.
[Mono] Probing '_monodroid_gref_log_delete'.
[Mono] Found as '_monodroid_gref_log_delete'.
[Mono] DllImport attempting to load: 'libcyusb.so'.
[Mono] DllImport error loading library
'/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/libcyusb.so':
'Cannot load library: load_library(linker.cpp:746): library
"/data/data/LibraryDenemesi.LibraryDenemesi/lib//storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/libcyusb.so"
not found'.
[Mono] DllImport error loading library
'/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/libcyusb.so':
'Cannot load library: load_library(linker.cpp:746): library
"/data/data/LibraryDenemesi.LibraryDenemesi/lib//storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/libcyusb.so"
not found'.
[Mono] DllImport error loading library 'libcyusb.so': 'Cannot load library:
load_library(linker.cpp:746): library
"/data/data/LibraryDenemesi.LibraryDenemesi/lib/libcyusb.so" not found'.
[Mono] DllImport error loading library 'libcyusb.so': 'Cannot load library:
load_library(linker.cpp:746): library
"/data/data/LibraryDenemesi.LibraryDenemesi/lib/libcyusb.so" not found'.
[Mono] DllImport error loading library 'libcyusb.so': 'Cannot load library:
load_library(linker.cpp:746): library
"/data/data/LibraryDenemesi.LibraryDenemesi/lib/libcyusb.so" not found'.
[Mono] DllImport unable to load library 'Cannot load library:
load_library(linker.cpp:746): library
"/data/data/LibraryDenemesi.LibraryDenemesi/lib/libcyusb.so" not found'.
[Mono] Assembly Ref addref CypressDenemeLibrary[0x5f6dd4f8] ->
Mono.Android[0x5aa93670]: 3
[Mono] DllImport attempting to load: '/system/lib/liblog.so'.
[Mono] DllImport loaded library '/system/lib/liblog.so'.
[Mono] DllImport searching in: '/system/lib/liblog.so'
('/system/lib/liblog.so').
[Mono] Searching for '__android_log_print'.
[Mono] Probing '__android_log_print'.
[Mono] Found as '__android_log_print'.
System.DllNotFoundException: libcyusb.so
  at (wrapper managed-to-native) DataDeneme:libusb_init ()
  at LibraryDenemesi.MainActivity.OnCreate (Android.OS.Bundle bundle)
[0x0004e] in
c:\Users\Sercan\Documents\Projects\LibraryDenemesi\LibraryDenemesi\MainActivity.cs:34
[libEGL] loaded /system/lib/egl/libEGL_mali.so
[libEGL] loaded /system/lib/egl/libGLESv1_CM_mali.so
[libEGL] loaded /system/lib/egl/libGLESv2_mali.so
[] Device driver API match
[] Device driver API version: 17
[] User space API version: 17
[] mali: REVISION=Linux-r3p1-01rel1 BUILD_DATE=Fri May 10 18:36:49 KST 2013
[OpenGLRenderer] Enabling debug mode 0



2014-11-26 12:28 GMT+02:00 Burhan Eyuboglu <burhaneyuboglu at gmail.com>:

>
> ---------- Forwarded message ----------
> From: Jonathan Pryor <jonpryor at vt.edu>
> Date: 2014-11-25 17:47 GMT+02:00
> Subject: Re: [Mono-dev] Using .so file in Android Library Project and then
> using it in an Android App
> To: Burhan Eyuboglu <burhaneyuboglu at gmail.com>
>
>
> On Nov 25, 2014, at 7:17 AM, Burhan Eyuboglu <burhaneyuboglu at gmail.com>
> wrote:
> > I was trying to import with wrong name : "cylibusb". My library's name
> is libcyusb.so.
> > You said that libcyusb.so should be in the .apk files in the previous
> mails, however I open the apk files (armeabi-v7a) and copy the libcyusb.so
> into them and run the application,then it gives same error and when I look
> at apk files after runining, there is no libcyusb.so in them.
> >
> > How can I put libcyusb.so to the lib/armeabi-v7a?
>
> You need to add libcyusb.so to your project with a Build action of
> AndroidNativeLibrary.
>
> When adding libcyusb.so to your project, it must be located in a directory
> that matches the ABI, e.g. you should have a
> native-libs\armeabi-v7a\libcyusb.so file, and add that file to your project
> with a Build action of AndroidNativeLibrary.
>
>  - Jon
>
>
> I need .so file with AndroidLibraryProject not with
> AndroidApplicationProject, and in the AndroidLibraryProject, there is no
> lib or lib/armeabi-v7a folder. Where can I put libcyusb.so?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20141126/897b2fa2/attachment-0001.html>


More information about the Mono-devel-list mailing list