这里有一点问题。我正在尝试移植开源应用程序IMSdroid以使用更新,更一致的构建系统。我已经让ANT正常工作,但需要Android.mk工作才能让生活更轻松。 (使用Gradle和Android.mk自动完成所有重建,从而更轻松地添加新功能和编解码器。)
JAR文件正常工作。
.so文件未包含在最终的APK中。这不是我第一次使用Android.mk而且这个让我感到困惑。
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)
然后在/ jni文件夹
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)
我需要它基本上使用包含所有库文件的/ libs构建的APK。在这一点上,它没有。
答案 0 :(得分:2)
观察结果:
在您的第一个Android.mk文件中,我认为您最后不需要include $(BUILD_SHARED_LIBRARY)
。
尝试将路径预先添加到LOCAL_SRC_FILES引用中,例如:
LOCAL_PATH:= $(致电my-dir)
包括$(CLEAR_VARS)
LOCAL_MODULE:= libplugin_audio_opensles
LOCAL_SRC_FILES:= $(LOCAL_PATH)/libplugin_audio_opensles.so
包括$(PREBUILT_SHARED_LIBRARY)
另外,请查看https://android.googlesource.com/platform/packages/apps/Camera2/+/android-4.4.4_r2.0.1/Android.mk - 您可以尝试LOCAL_JNI_SHARED_LIBRARIES