Build for Android
On this page
Placeholder page for information about building for Android.
Include info about which frameworks we support building for Android, plus any specific version or compatibility info worth calling out?
Build an Android App
The SDK supports building Android apps with C++. To build an Android app:
Add
<uses-permission android:name="android.permission.INTERNET" />
to yourAndroidManifest.xml
Add the SDK's subdirectory to your native library's
CMakeLists.txt
and link it as a target library:set(CMAKE_CXX_STANDARD 17) add_subdirectory("realm-cpp") ... target_link_libraries( # Specifies the target library. myapplication # make sure to link the C++ SDK. cpprealm ) Ensure that the git submodules are initialized inside of the
realm-cpp
folder before building.When instantiating the database or the SDK App, you must pass the
filesDir.path
as thepath
parameter in the respective constructor or database open template.
For an example of how to use the SDK in an Android app, refer to
the Android RealmExample App
in the realm-cpp
GitHub repository.
Specifically, refer to the MainActivity.kt
& native-lib.cpp
files
in the Android example app for code examples.