Android: How can my C++ code call C/C++ functions from *.so library that is built into AAR bundle?

  .so, aar, android, c++, java-native-interface

I understand how Java uses System.loadLibrary() to load the *.so library from AAR at runtime and calls the C++ functions using JNI. Now I am facing a situation where I need to do that in C++ instead of Java. I need to have the C/C++ function symbols from the *.so library available in build time so that my C++ code (calling those functions in the *.so library) can be compiled and built correctly.

This old post Android NDK use .so library from c code inside JNI explains how to do that by just using the *.so library, but I am not able to make it work that way. Also, I can only work with the AAR bundle because it is shared to other Java code.

Is there a way to achieve that? Where is the path to the *.so after installing the AAR to my app?

Thank you in advance!

Source: Windows Questions C++

LEAVE A COMMENT