Skip to content

Add android native app support#7139

Merged
waruqi merged 20 commits intodevfrom
android
Dec 16, 2025
Merged

Add android native app support#7139
waruqi merged 20 commits intodevfrom
android

Conversation

@waruqi
Copy link
Member

@waruqi waruqi commented Dec 16, 2025

$ xmake f -p android
$ xmake
$ xmake run
add_rules("mode.debug", "mode.release")

add_requires("raylib 5.5.0")

target("raydemo_basic")
    set_kind("binary")
    set_languages("c++17")
    add_files("src/main.cpp")
    add_syslinks("log")
    add_packages("raylib")
    add_rules("android.native_app", {
        android_sdk_version = "35",
        android_manifest = "android/AndroidManifest.xml",
        android_res = "android/res",
        keystore = "android/debug.jks",
        keystore_pass = "123456",
        package_name = "com.raylib.basic",
        logcat_filters = {"raydemo_basic", "raylib"}
    })
image

    - Add glue file and jni interface file to target;
    - Generate android apk package at install stage;
    - Use adb to run the android app.
@waruqi waruqi added this to the v3.0.6 milestone Dec 16, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @waruqi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances Xmake's capabilities by integrating robust support for Android native application development. It introduces a new android.native_app rule that encapsulates the entire lifecycle from compilation and linking of C/C++ code to APK packaging, signing, installation, and running on an Android device. This feature streamlines the development workflow for native Android projects, making it easier for developers to leverage Xmake for cross-platform builds. Furthermore, the PR includes practical examples using LVGL and Raylib, showcasing how to build sophisticated native Android applications with these libraries.

Highlights

  • Android Native App Rule: Introduced a new android.native_app rule in Xmake, simplifying the build, packaging, installation, and execution of native Android applications.
  • Expanded Runnable Target Detection: Enhanced the xmake run command to correctly identify and execute targets that are runnable via custom rules, not just direct binaries or explicit run scripts.
  • New Example Projects: Added several comprehensive example projects demonstrating Android native app development with popular UI/graphics libraries, specifically LVGL (basic and particles) and Raylib (basic and particles).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for Android native applications, including new examples for LVGL and Raylib, and the necessary xmake rules. The implementation of the new android.native_app rule is well-structured and covers packaging, installation, and running. The examples are a great addition. I've found a few issues in the C code for the LVGL examples, mainly related to resource management (memory leaks) and code robustness. I've also pointed out a security concern with hardcoded passwords in the example xmake.lua files.

target:set("kind", "shared")

-- add glue file to target
local native_app_glue_file = path.join(ndk_root, "sources", "android", "native_app_glue", "android_native_app_glue.c")
Copy link
Member

@SirLynix SirLynix Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be automatically added when working on Android, you may want to have your own glue using the NDK (as I did).

Maybe add a way to disable the native glue?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, the GLFM library, for example doesn't need it (unless I didn't notice it). I'm working on a project where I used it before switching to GLFM, so being able to disable it would be welcome.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try this patch. #7141

@waruqi waruqi merged commit d1485fa into dev Dec 16, 2025
46 of 49 checks passed
@waruqi waruqi deleted the android branch December 16, 2025 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants