Integration of external libraries CMake and ndk-build into Android Studio project

I have two existing libraries that I would like to integrate into an Android project. One has a working Android.mk file and the other has a working CMakeList.txt file. Is there an easy way to link both with Gradle?

Using CMake ExternalProject [1] is the only idea I have at the moment.

[1] https://cmake.org/cmake/help/v3.0/module/ExternalProject.html

+3


source to share


2 answers


The solution I came up with was to add an extra Gradle module to build the ndk-build project. In Gradle terms, the project will become a multi-project / multi-module build and is discussed further here [1]. I was also able to express the dependency in Gradle and the project was built without issue.

My initial thought of using CMake ExternalBuild failed in Gradle, but will work fine when invoking CMake from the command line. This is probably due to my lack of knowledge in Gradle and CMake.



[1] https://speakerdeck.com/bmuschko/state-of-the-art-gradle-multi-module-builds

+1


source


I may have what you need. There is a whole c++

sample that does not include JAVA UI , which is actually a big thing because now your main

(entry point) is in a file c++

- you can do OOP and depend on third party libraries without too much hassle.



Check out my repo: https://github.com/skanti/Android-Manual-Build-Command-Line

0


source







All Articles