android-ndk

Configure Android NDK native builds for Gradle, CMake, and Soong modules.

1|Updated Feb 28, 2026
One-click install
npx skills add https://github.com/Binh230199/ai --skill android-ndk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-ndk
Source: https://github.com/Binh230199/ai/tree/main/.github/skills/android-ndk
Command: npx skills add https://github.com/Binh230199/ai --skill android-ndk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you set up, review, and troubleshoot Android NDK native library integration so C and C++ code builds cleanly with Android projects and AOSP modules.

Core Features & Use Cases

  • Gradle and CMake Setup: Configure external native builds, library targets, include paths, and Android-friendly CMake options.
  • AOSP Soong Integration: Define cc_library_shared and prebuilt shared libraries in Android.bp for platform builds.
  • Runtime Loading and Debugging: Load native libraries from Java or Kotlin, choose ABI filters and STL settings, and diagnose missing-library or crash issues.
  • Use Case: A developer adding an audio processing library to an Android app can use this Skill to select arm64-v8a, link log and android system libraries, and expose native methods through System.loadLibrary.

Quick Start

Ask for a complete Android NDK integration plan for your module, including Gradle or Soong setup, ABI selection, STL choice, and native library loading guidance.

Frequently Asked Questions about android-ndk

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure CMake for an Android NDK native build in Gradle?

You configure the Android NDK native build by adding external native build entries to Gradle, defining CMake library targets, specifying include paths, and applying Android-friendly options to compile C and C++ code.

What is the best way to add a prebuilt shared library to an AOSP Soong module?

The best way to add a prebuilt shared library to an AOSP Soong module is by defining cc_library_shared or prebuilt shared library entries in your Android.bp file to integrate C and C++ code into platform builds.

Why does System.loadLibrary fail to load my Android native library?

System.loadLibrary fails to load your Android native library due to incorrect ABI filters, mismatched STL settings, or incomplete library linkage, requiring proper NDK toolchain setup and packaging constraint checks to resolve.

How do I select target ABIs and API levels for an Android NDK project?

You select target ABIs and API levels for an Android NDK project by applying ABI filters like arm64-v8a in your Gradle or Soong configuration, ensuring the NDK toolchain targets the correct Android API level for your native libraries.

Can I use C++ STL with Android NDK CMake builds?

Yes, you can use C++ STL with Android NDK CMake builds by selecting the appropriate STL settings in your Gradle configuration, which ensures proper library linkage and satisfies Android build constraints for native code.

When do I need to use Android NDK for my app?

You need to use the Android NDK when adding shared C and C++ libraries to your app, requiring native build integration through CMake or AOSP Soong modules to compile and package the code with Java or Kotlin loading patterns.