Android.mk 常用模块类型

2024-01-08 13:53:56

1 apk

include $(CLEAR_VARS)
LOCAL_MODULE := myapp
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_CERTIFICATE := platform
include $(BUILD_PACKAGE)

2 shared_library

  • 生成的是动态库(.so 文件)
include $(CLEAR_VARS)
LOCAL_MODULE := mylibrary
LOCAL_SRC_FILES := mylibrary.cpp
include $(BUILD_SHARED_LIBRARY)

3 static_library

  • 生成的是静态库(.a 文件)
include $(CLEAR_VARS)
LOCAL_MODULE := mylibrary
LOCAL_SRC_FILES := mylibrary.cpp
include $(BUILD_STATIC_LIBRARY)

4 java_binary

  • 用于编译 Java 代码并生成可执行的 Java 程序(.jar 文件)
include $(CLEAR_VARS)
LOCAL_MODULE := mylibrary
LOCAL_SRC_FILES := $(call all-java-files-under, src)
include $(BUILD_JAVA_LIBRARY)

5 cc_binary

  • 用于编译 C/C++ 代码并生成可执行的 C/C++ 程序
include $(CLEAR_VARS)
LOCAL_MODULE := myexecutable
LOCAL_SRC_FILES := myexecutable.cpp
include $(BUILD_EXECUTABLE)

文章来源:https://blog.csdn.net/qq_30883899/article/details/135402991
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。