这里有点问题。我正在尝试移植开源应用程序 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)
我需要它基本上使构建的 APK 与包含所有库文件的 /libs 一起出现。在这一点上,它没有。