Search code examples
androidantandroid-ndkandroid.mkandroid-embedded-api

Android.mk , inking but not including Shared Libs in output


Having a bit of an issue here. I am trying to port over the open source application IMSdroid to work with newer and more consistent build systems. I already got ANT working correctly, but need Android.mk working as well to make life easier. (Make all rebuilds automated with Gradle and Android.mk, enabling easier additions of new capabilities and codecs.)

The JAR files work fine.

The .so files are NOT being included in the final APK. Its not my first time with Android.mk and this one is just puzzling me.

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional

LOCAL_CERTIFICATE := debug
LOCAL_PACKAGE_NAME := IMSdroid

LOCAL_JAVA_LIBRARIES := telephony-common telephony-msim 
LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4 android-support-v13 libandroid-ngn-stack libsimple-xml-2.3.4

LOCAL_SHARED_LIBRARIES := libplugin_audio_opensles libtinyWRAP libutils

LOCAL_SRC_FILES := $(call all-java-files-under, src)

LOCAL_PROGUARD_ENABLED := disabled

include $(BUILD_PACKAGE)

##################################################
include $(CLEAR_VARS)

LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := libandroid-ngn-stack:libs/android-ngn-stack.jar libsimple-xml-2.3.4:libs/simple-xml-2.3.4.jar

include $(BUILD_MULTI_PREBUILT)

##################################################
include $(call all-makefiles-under,$(LOCAL_PATH))

LOCAL_LDFLAGS := -L$(LOCAL_PATH)/jni/

include $(BUILD_SHARED_LIBRARY)

Then in /jni folder

include $(CLEAR_VARS)

LOCAL_MODULE := libplugin_audio_opensles
LOCAL_SRC_FILES := libplugin_audio_opensles.so 

include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := libtinyWRAP
LOCAL_SRC_FILES := libtinyWRAP.so 

include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)

LOCAL_MODULE := libutils
LOCAL_SRC_FILES := libutils_armv5te.so

include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := libtinyWRAP_neon
LOCAL_SRC_FILES := libtinyWRAP_neon.so 

include $(PREBUILT_SHARED_LIBRARY)

I need it to basically have the APK as built appear with /libs containing all of the library files. AT this point, it does not.


Solution

  • Couple of observations:

    • In your first Android.mk file, I don't think you need the include $(BUILD_SHARED_LIBRARY) at the end.

    • Try prepending the path to the LOCAL_SRC_FILES references, for exmaple:

      LOCAL_PATH:= $(call my-dir)

      include $(CLEAR_VARS)

      LOCAL_MODULE := libplugin_audio_opensles

      LOCAL_SRC_FILES := $(LOCAL_PATH)/libplugin_audio_opensles.so

      include $(PREBUILT_SHARED_LIBRARY)

    • Also, check out https://android.googlesource.com/platform/packages/apps/Camera2/+/android-4.4.4_r2.0.1/Android.mk - you might could try that LOCAL_JNI_SHARED_LIBRARIES