How to include AIDL-generated headers in native code in AOSP?

508 views
Skip to first unread message

TblS

unread,
Jan 12, 2023, 8:05:35 PM1/12/23
to Android Building
I have a native module under /devices:

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

I want to use binder in this module. My 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)

When I'm building it, it generates C++ headers, but they are located in the intermediates directory only:


$ ls out/target/product/emulator_x86_64/obj/SHARED_LIBRARIES/libMyModule_intermediates/aidl-generated/include/com/my/package: BnMyInterface.h BpMyInterface.h IMyInterface.h

How should I include them in my Proxy.cpp? If I just add #include "IMyInterface.h", build system doesn't see it: fatal error: 'IMyInterface.h' file not found 

Mohammad Hossein Heydarchi

unread,
Apr 4, 2023, 12:08:31 AM4/4/23
to Android Building
I have posted some articles about AIDL. You can have a look. Ther also a git repo to see how it works.

Reply all
Reply to author
Forward
0 new messages