【问题标题】:How to include AIDL-generated headers in native code in AOSP?如何在 AOSP 的本机代码中包含 AIDL 生成的标头?
【发布时间】:2023-01-25 08:27:23
【问题描述】:

我在/devices下有一个原生模块:

- module
-- aidl
--- com
---- my
----- package
------ IMyInterface.aidl
-- Android.mk
-- Proxy.h
-- Proxy.cpp

我想在这个模块中使用活页夹。我的Android.mk

LOCAL_PATH := $(call my-dir)

$(call emugl-begin-shared-library,libMyModule)

LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/aidl

LOCAL_SRC_FILES := \
    aidl/com/my/package/IMyInterface.aidl \
    Proxy.cpp \


LOCAL_HEADER_LIBRARIES := libbinder_headers \
                          libhidlbase_impl_internal \
                          libbase

LOCAL_SHARED_LIBRARIES :=       \
        libbinder               \
        libutils                \
        liblog                  \
        libcutils

$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
$(call emugl-import,libOpenglCodecCommon$(GOLDFISH_OPENGL_LIB_SUFFIX))

$(call emugl-end-module)

当我构建它时,它会生成 C++ 标头,但它们仅位于 intermediates 目录中:

$ ls out/target/product/emulator_x86_64/obj/SHARED_LIBRARIES/libMyModule_intermediates/aidl-generated/include/com/my/package:

BnMyInterface.h  BpMyInterface.h  IMyInterface.h

我应该如何将它们包含在我的Proxy.cpp 中?如果我只是添加#include "IMyInterface.h",构建系统看不到它:fatal error: 'IMyInterface.h' file not found

【问题讨论】:

    标签: android c++ android-source aidl android-soong


    【解决方案1】:

    您可能必须像 #include <com/my/package/BnMyInterface.h> 一样包含它

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-06-26
      • 1970-01-01
      • 1970-01-01
      • 2019-08-28
      • 1970-01-01
      • 2017-05-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多