İncluding .so files in Android.mk builds

67 Views Asked by At

I have a codebase consisting of java code that i can run in android studio. I use ffmpeg-kit as external library and it works fine in android studio. But I have to compile it using an Android.mk file and I get the .so files not found error. I tried including them in a separate mk file where I declare them as separate modules and build but still get the same issue. When I analyze the apk file generated I cannot see the lib folder where so files with their respective abis are located.

Edit: Android.mk file:

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := libabidect
LOCAL_SRC_FILES := src/jni/libffmpegkit_abidetect.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := ffmpegkit
LOCAL_SRC_FILES := ffmpegkit.c
LOCAL_LDLIBS := -llog
LOCAL_SHARED_LIBRARIES := libabidect
LOCAL_C_INCLUDES := ffmpegkit
include $(BUILD_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_SYSTEM_EXT_MODULE := true
LOCAL_MODULE_OWNER := mtk
LOCAL_MODULE_TAGS := optional
LOCAL_CERTIFICATE := platform

LOCAL_STATIC_ANDROID_LIBRARIES := \
    android-support-constraint-layout \
    android-support-v17-leanback \
    android-support-design \
    android-support-v4 \

LOCAL_STATIC_JAVA_AAR_LIBRARIES := \
    lottie \
    ffmpeg \

LOCAL_STATIC_JAVA_LIBRARIES := \
    android-support-constraint-layout-solver \
    com.mediatek.support.factory \
    aaa \
    AudioAnalyzer \
    javaee-api \ 

LOCAL_RESOURCE_DIR := \
    $(LOCAL_PATH)/res
LOCAL_USE_AAPT2 := true
LOCAL_SRC_FILES := \
    $(call all-java-files-under, src)

LOCAL_PACKAGE_NAME := PACKAGE_NAME
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_DEX_PREOPT := false
include $(BUILD_PACKAGE)

include $(CLEAR_VARS)
 LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \
    lottie:libs/lottie-2.7.0.aar \
    AudioAnalyzer:libs/AudioAnalyzer.jar \
    ffmpeg:libs/ ffmpeg-kit-full-gpl-6.0.aar \
    javaee-api:libs/javaee-api-8.0.1.jar \

LOCAL_SHARED_LIBRARIES := libabidect 
include $(BUILD_MULTI_PREBUILT)

Build script:

# Prepare some environment variables before build
export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8

# Apply patch before build
# bash vendor/mediatek/tv/build/android/android_r_base_build_fusion.sh
source build/envsetup.sh

m -j4 WEEKLY_BUILD_TYPE=PRETEST EMMC_SIZE=16G PACKAGE
0

There are 0 best solutions below