当前位置:   article > 正文

Android.mk转Android.bp及介绍_android.mk转成android.bp

android.mk转成android.bp

一、Android.mk转成Android.bp是可以通过工具转换的

工具的路径为:ASOP/out/soong/host/linux-x86/bin/androidmk

直接把你要转换的Android.mk 文件放置到此目录下,然后执行命令:

./androidmk Android.mk > Android.bp

二、编译不同类型模块的写法

1、编译成 Java

  1. Android.mk
  2. include $(BUILD_JAVA_LIBRARY)
  3. Android.bp
  4. java_library {
  5. ......
  6. }

2 编译成 Java 静态库

  1. Android.mk
  2. include $(BUILD_STATIC_JAVA_LIBRARY)
  3. Android.bp
  4. java_library_static {
  5. ......
  6. }

3 编译成 App 应用

  1. Android.mk
  2. include $(BUILD_PACKAGE)
  3. Android.bp
  4. android_app {
  5. ......
  6. }

4、 编译成 Native 动态库

  1. Android.mk
  2. include $(BUILD_SHARED_LIBRARY)
  3. Android.bp
  4. cc_library_shared {
  5. ......
  6. }

5 编译成 Native 静态库

  1. Android.mk
  2. include $(BUILD_STATIC_LIBRARY)
  3. Android.bp
  4. cc_library_static {
  5. ......
  6. }

6、编译成 Native 执行程序

  1. Android.mk
  2. include $(BUILD_EXECUTABLE)
  3. Android.bp
  4. cc_binary {
  5. ......
  6. }

7、编译成头文件库

  1. Android.mk
  2. include $(BUILD_HEADER_LIBRARY)
  3. Android.bp
  4. cc_library_headers {
  5. ......
  6. }

8、添加本地头文件路径

  1. Android.mk
  2. LOCAL_C_INCLUDES :=
  3. Android.bp
  4. local_include_dirs: ["xxx", ...]

9、导出的头文件路径

  1. Android.mk
  2. LOCAL_EXPORT_C_INCLUDE_DIRS :=
  3. Android.bp
  4. export_include_dirs: ["xxx", ...]

10、设置资源文件路径

  1. Android.mk
  2. LOCAL_RESOURCE_DIR :=
  3. Android.bp
  4. resource_dirs: ["xxx", ...]

11、添加依赖的静态库

  1. Android.mk
  2. LOCAL_STATIC_LIBRARIES :=
  3. Android.bp
  4. static_libs: ["xxx", "xxx", ...]

12、添加依赖的动态库

  1. Android.mk
  2. LOCAL_SHARED_LIBRARIES :=
  3. Android.bp
  4. shared_libs: ["xxx", "xxx", ...]

13、添加依赖的头文件库

  1. Android.mk
  2. LOCAL_JAVA_LIBRARIES :=
  3. Android.bp
  4. header_libs: ["xxx", "xxx", ...]

14、添加依赖的 Java 库

  1. Android.mk
  2. LOCAL_STATIC_JAVA_LIBRARIES :=
  3. Android.bp
  4. static_libs: ["xxx", "xxx", ...]

15、应用安装到vendor中

  1. Android.mk
  2. LOCAL_VENDOR_MODULE := true
  3. or
  4. LOCAL_PROPRIETARY_MODULE := true
  5. Android.bp
  6. proprietary: true
  7. or
  8. vendor: true

16、应用安装到product中

  1. Android.mk
  2. LOCAL_PRODUCT_MODULE := true
  3. Android.bp
  4. product_specific: true

17、应用安装到odm中

  1. Android.mk
  2. LOCAL_ODM_MODULE := true
  3. Android.bp
  4. device_specific: true

18、添加编译参数(宏开关)

  1. C语言
  2. Android.mk
  3. LOCAL_CFLAGS :=
  4. Android.bp
  5. cflags: ["xxx", "xxx", ...]
  6. ------------------------------------------------------
  7. C++
  8. Android.mk
  9. LOCAL_CPPFLAGS :=
  10. Android.bp
  11. cppflags: ["xxx", "xxx", ...]
  12. ----------------------------------------------------------
  13. JAVA
  14. Android.mk
  15. LOCAL_JAVACFLAGS :=
  16. Android.bp
  17. javacflags: ["xxx", "xxx", ...]

更多精彩尽在公众号:Android全贯通

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/526377
推荐阅读
相关标签
  

闽ICP备14008679号