How can a C++ client bind to AIDL service on Android?

63 Views Asked by At

This is what I want to achieve

  • I have an Android AIDL server implemented in Java
  • I want to bind or connect to the Java server from my C++ code. My C++ code is not called by another Android app; instead, it is a standalone native program (with entry point int main(int argc, char *argv[])) running outside of a sandbox.

I used aidl binary to generate some .cpp and .h from my IMyService.aidl, but when trying to compile them with my C++ program, these generated C++ files refer to some other header files such as "<binder/IBinder.h>" which are not part of NDK. Instead, they are part of AOSP framework. I am new to AOSP framework, so my question is how to build a C++ standalone program with reference to AOSP framework? How do I set up the build environment so my build can find those files in AOSP framework?

I did some research and found this article, but still I cannot find my answers after reading it.

Thanks!

0

There are 0 best solutions below