Android Application
We can use the android.native_app rule to build Android native applications.
Native App
EXPLORER
src
android
AndroidManifest.xml
main.cpp
xmake.lua
Lua xmake.lua
12345678910
add_rules("mode.debug", "mode.release")
target("android_app")
set_kind("binary")
add_files("src/*.cpp")
add_rules("android.native_app", {
android_manifest = "src/android/AndroidManifest.xml",
package_name = "com.xmake.demo",
android_sdk_version = "35"
})
Build and Run
bash
$ xmake f -p android --ndk=/path/to/ndk
$ xmake
$ xmake install
$ xmake runCustom Glue
If you want to use custom glue code (or standard android_native_app_glue), you can do so by creating a project with the appropriate AndroidManifest.xml and native code.
EXPLORER
src
android
AndroidManifest.xml
main.c
xmake.lua
Lua xmake.lua
12345678910
add_rules("mode.debug", "mode.release")
target("app")
set_kind("binary")
add_files("src/*.c")
add_rules("android.native_app", {
android_manifest = "src/android/AndroidManifest.xml",
package_name = "com.xmake.custom_glue",
android_sdk_version = "35"
})