How to get my .so libraries copied to an Android device?

To summarize in one line: not all of my libs/armeabi/*.so files are copied to the device when my application starts. I'll try to explain.

Directory structure

I am trying to get ffmpeg on Android and therefore has the following structure for NDK:

 jni β”œβ”€β”€ Android.mk β”œβ”€β”€ bambuser_ffmpeg β”‚  β”œβ”€β”€ Android.mk β”‚  β”œβ”€β”€ libavcodec.so β”‚  β”œβ”€β”€ libavcore.so β”‚  β”œβ”€β”€ libavdevice.so β”‚  β”œβ”€β”€ libavfilter.so β”‚  β”œβ”€β”€ libavformat.so β”‚  β”œβ”€β”€ libavutil.so β”‚  └── libswscale.so └── video β”œβ”€β”€ Android.mk β”œβ”€β”€ at_ac_univie_gameclient_video_VideoGLSurfaceView.c β”œβ”€β”€ at_ac_univie_gameclient_video_VideoGLSurfaceView.h └── at_ac_univie_gameclient_video_VideoGLSurfaceView_GLRenderer.h 

Android.mk Files

The Android.mk file in bambuser_ffmpeg says:

 include $(CLEAR_VARS) LOCAL_MODULE := bambuser-libavcodec LOCAL_SRC_FILES := libavcodec.so include $(PREBUILT_SHARED_LIBRARY) # and so on, for all of the above .so files 

The second Android.mk file has the following:

 LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := ffmpeg LOCAL_STATIC_LIBRARIES := bambuser-libavcodec bambuser-libavcore bambuser-libavdevice bambuser-libavfilter bambuser-libavformat bambuser-libavutil bambuser-libswscale LOCAL_SRC_FILES := at_ac_univie_gameclient_video_VideoGLSurfaceView.c LOCAL_C_INCLUDES := $(LOCAL_PATH)/../bambuser_ffmpeg/ LOCAL_LDLIBS := -L$(LOCAL_PATH)/../bambuser_ffmpeg -lavcodec -lavcore -lavdevice -lavfilter -lavformat -lavutil -lswscale -llog -lz -lGLESv1_CM include $(BUILD_SHARED_LIBRARY) 

Exit

So, when I run ./ndk-build , I get this output. It looks good, right?

 Prebuilt : libavcodec.so <= jni/bambuser_ffmpeg/ Install : libavcodec.so => libs/armeabi/libavcodec.so Prebuilt : libavcore.so <= jni/bambuser_ffmpeg/ Install : libavcore.so => libs/armeabi/libavcore.so Prebuilt : libavdevice.so <= jni/bambuser_ffmpeg/ Install : libavdevice.so => libs/armeabi/libavdevice.so Prebuilt : libavfilter.so <= jni/bambuser_ffmpeg/ Install : libavfilter.so => libs/armeabi/libavfilter.so Prebuilt : libavformat.so <= jni/bambuser_ffmpeg/ Install : libavformat.so => libs/armeabi/libavformat.so Prebuilt : libavutil.so <= jni/bambuser_ffmpeg/ Install : libavutil.so => libs/armeabi/libavutil.so Prebuilt : libswscale.so <= jni/bambuser_ffmpeg/ Install : libswscale.so => libs/armeabi/libswscale.so Install : libffmpeg.so => libs/armeabi/libffmpeg.so 

Problem

When I launched the Android app, it will try to download libffmpeg.so . Of course, my local libs directory contains all the necessary libraries, as they were created / copied before:

 libs └── armeabi β”œβ”€β”€ libavcodec.so β”œβ”€β”€ libavcore.so β”œβ”€β”€ libavdevice.so β”œβ”€β”€ libavfilter.so β”œβ”€β”€ libavformat.so β”œβ”€β”€ libavutil.so β”œβ”€β”€ libffmpeg.so └── libswscale.so 

However, on the device itself there is only my libffmpeg.so file. It is located at at.ac.univie.gameclient/lib/libffmpeg.so and is automatically copied there. Where are the other .so files located and how to get them on the device?

Also, just manually copying them, of course, is not my desired solution.

+7
source share
1 answer

You are absolutely sure that all your libraries are before downloading the application. Yes, I saw that you wrote that they are, but when you build the jni project, it deletes all your existing files in the libs directory. So, upgrade before downloading it to double check.

+1
source

All Articles