Issue
I have read other questions similar to this on stack overflow but they are not having same like scenario.
I have FreeImage.a(23 MB file ) file which precompild static library for android. I also have source code of FreeImage Project which have header files.
I want to build .SO file from (.a) file I have with my JNI code(FreeImageCompilation.cpp) Below code compiles fine but it does produces SO File of (5KB only ) whre (*.a file is 23 MB )?
can somebody check if my code below for using *.a file is correct or not ?
In My Android.mk I have following code.
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := FreeImage
LOCAL_SRC_FILES := libFreeImage.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/FreeImage/Source/
include $(PREBUILT_STATIC_LIBRARY)
#My Own SO file
LOCAL_STATIC_LIBRARIES := FreeImage
include $(CLEAR_VARS)
LOCAL_MODULE := FreeImageSo
LOCAL_SRC_FILES := FreeImageCompilation.cpp
LOCAL_STATIC_LIBRARIES := FreeImage
include $(BUILD_SHARED_LIBRARY)
Solution
It's totally correct but you seem to be confused about concepts. Your static library is not included in your shared library as you seem to expect. Your static library is just linked to the shared library. In the end, your program needs an .so file and an .a to function properly, not just one big .so that holds everything.
Answered By - eozgonul
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.