I want to use libjpeg.so in my android project.
I have precompiled shared library.
Build script in my project:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libjpeg
LOCAL_SRC_FILES :=../lib1/libjpeg.so
include $(PREBUILT_SHARED_LIBRARY)
But what do i get.
source file lib1/libjpeg.so - 1 290 798 bytes
but file after building libs/armeabi/libjpeg.so - 247 236 bytes
I have analyse this 2 files - the second is just truncated
And of course i have "java.lang.UnsatisfiedLinkError"
Why file truncated ?
The problem is that NDK build system strips all prebuilt shared libraries when copying them to destination folder.
If you really need to use a libjpeg as shared library, then I would suggest that you run a post build script to copy the original file to the destination folder overwriting the stripped one.
The best solution is to prebuild a libjpeg.a static library and then you can avoid stripping like this:
Notice the LOCAL_WHOLE_STATIC_LIBRARIES which turns off the stripping for these libs.