C++ library in an Android application | Declaration of VAR

submited by
Style Pass
2024-02-13 10:00:05

We have a C++ library, which our customers are using on a variety of platforms. Mainly in desktop applications on Windows, Mac OS and GNU/Linux, but there are also web-applications (for which we compile it into WebAssembly with Emscripten), and now we got a request to make it work in Android applications too (or rather to provide a binding/wrapper).

This particular example will be about a Kotlin-based application. I don’t know what would be different in case of a Java-based application, but I suppose that principal things should be more or less the same in both.

Some years ago I’ve briefly touched the topic of building applications for Android, but there it was done with Qt, and most of the complexity was graciously hidden from me by Qt Creator, which was auto-magically compiling my C++/QML application sources into the final APK without me knowing anything about the actual process.

Most of the required components come together with Android Studio, so download and install it. When you launch it for the first time, it will choose some default SDK/API versions to be downloaded:

Leave a Comment