android - java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++.so" not found -
i trying use 2 prebuilt native libraries (.so) in android application. have created jni project have done following,
- created java native library , compiled javac
- created c header javah -jni command
- created corresponding c source file methods implemented
- this c source code (the methods in it) refer methods .so file expose
- android.mk file written. given below.
- using ndk-build built , pushed mobile
android.mk
local_path := $(call my-dir) include $(clear_vars) local_module := libmodule1 local_src_files := prebuilts/$(target_arch_abi)/libmodule1.so include $(prebuilt_shared_library) include $(clear_vars) local_module := libmodule2 local_src_files := prebuilts/$(target_arch_abi)/libmodule2.so include $(prebuilt_shared_library) include $(clear_vars) local_module := com_example_androidwrapper_nativelibrary local_src_files := com_example_androidwrapper_nativelibrary.c local_shared_libraries := libmodule1 libmodule2 include $(build_shared_library)
when run app getting following error.
java.lang.unsatisfiedlinkerror: dlopen failed: library "libc++.so" not found
if dont load module1, module2 libraries app work fine (i commented out calls methods exposed these 2 modules , rewrote android.mk file build shared library , not use prebuilt ones) working fine.
any appreciated. thanks.
i had used prebuilt .so files native application ran in same target device. when changed application.mk "app_abi := all" gave me following error.
[x86_64] prebuilt : module1.so <= jni/ [x86_64] install : module1.so => libs/x86_64/module1.so c:/users/user/appdata/local/android/android-ndk-r12b/build//../toolchains/x86_64-4.9/prebuilt/windows/bin/x86_64-linux-android-strip: un able recognise format of input file `./libs/x86_64/module1.so' make: *** [libs/x86_64/module1.so] error 1 make: *** deleting file `libs/x86_64/module1.so'
i think prebuilt .so files supposed run in arm64-v8a itself.
what libmodule1.so? sounds it's library pulled off android device , trying use. that's pretty going work exact device pulled from.
as second part, sounds libraries in x86_64 directory aren't x86_64 libraries. try $ndk/toolchains/x86_64-4.9/prebuilt/$your_os/bin/x86_64-linux-android-readelf -h module1.so
. print elf header library. 1 of lines should be:
machine: advanced micro devices x86-64
if value of machine else, it's not x86_64 library.
Comments
Post a Comment