I have 2 modules in this project: app
and libdatacpp
libdatacpp
is mainly a C++ project but uses some java code
app
is mainly a java project, but uses some c++ code
When building the project, I get c++ linker errors for undefined functions from libdatacpp
, because the app
project doesn't link libDataCpp.o
In my cmake for app
, I am linking against libDataCpp
like this:
target_link_libraries(
native-lib
DataCpp)
I also link against the other project in the app
module's build.gradle
like this:
dependencies {
api project(':libdatacpp')
How can I get the app
module to automatically link against my libdatacpp
module?
If you intend to provide
libdatacpp
native library for other AndroidStudio projects through .aar, then you need to use prefab feature.But if these native library is part of your own project, then I don't see the need to put it in the .aar, just put its stuff (sources and CMakeLists.txt) in a subfolder and add it to build by using
add_subdirectory (datacpp)
in your main CMake.