简体   繁体   中英

One of many prebuilt libraries is not included on ndk-build

I'm developing an android application with some native code. I also have some native prebuilt libs that should be included in the project. First I put the prebuilt libs in the libs/armeabi folder of the project. But the problem was that these files got deleted on build.

So I googled a little bit and found that you have to include these prebuilt libraries in you Android.mk file to be copied to the libs/armeabi folder.

Here is a part of my Android.mk:

[...]
include $(CLEAR_VARS)

LOCAL_MODULE := libavcodec
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libavcodec.so

include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := libavdevice
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libavdevice.so

include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := libavfilter
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libavfilter.so

include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := libavformat
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libavformat.so

include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := libavutil
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libavutil.so

include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := libmetaiosdk
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libmetaiosdk.so

include $(PREBUILT_SHARED_LIBRARY)


include $(CLEAR_VARS)
LOCAL_MODULE := libswscale
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libswscale.so
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := libswresample
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libswresample.so

include $(PREBUILT_SHARED_LIBRARY)
[EOF]

The problem is: All of these files are in the same directory and all of these files get copied to the libs/armeabi folder. Except one file! The libswscale.so does not get copied. I have no idea what's wrong here. I definitely do not have a typo in the file name.

Am I missing something. Perhaps anybody had a similar problem?

Thanks in advance!

I did not know that the Android.mk file is proccessed unordered . The last missing lib was not copied because there was an error inbetween. So the mistake was that I expected the Android.mk file to be proccessed in a linear order from top to bottom. But this is not the case. The missing library was copied at the end of the build probably because of the LOCAL_MODULE naming (all libs begin with libav except the libswscale).

Hope this save other people some time (I took a while to realize it).

Probably, libswresample was not added in Android.mk file under LOCAL_SHARED_LIBRARIES .

This worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM