android-slim-bindings

Generate slim C# bindings for selected Android Java/Kotlin APIs.

209|27|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/dotnet/maui-labs --skill android-slim-bindings-dotnet
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-slim-bindings
Source: https://github.com/dotnet/maui-labs/tree/main/plugins/dotnet-maui/skills/android-slim-bindings
Command: npx skills add https://github.com/dotnet/maui-labs --skill android-slim-bindings-dotnet

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Native Android SDKs often expose functionality only through Java/Kotlin (AAR/JAR/Maven artifacts), and .NET MAUI developers need a reliable way to make only the required APIs available to C# without wrestling with a huge, brittle full binding surface.

Core Features & Use Cases

  • Create slim Native Library Interop wrappers: Build a thin Java/Kotlin wrapper that exposes only the APIs you want from a native Android library.
  • Manage Maven/AAR dependencies for bindings: Analyze the full Gradle dependency tree, map Maven artifacts to the correct NuGet bindings, and handle missing transitive dependencies using .NET Android binding mechanisms.
  • Generate C# bindings with metadata transforms: Use Transforms/Metadata.xml to rename namespaces/parameters and remove or adjust problematic types so the generated APIs are usable from MAUI/C#.
  • Update bindings as native SDKs evolve: Rebuild the wrapper AAR, refresh Maven/NuGet dependencies, and iterate on metadata transforms and troubleshooting until the binding compiles and runs.

Quick Start

Provide the Maven coordinates (or AAR/JAR source) of the Android library and ask the assistant to generate the minimal Java/Kotlin wrapper plus the corresponding .csproj configuration and Transforms/Metadata.xml strategy for producing slim Android bindings for .NET MAUI.

Frequently Asked Questions about android-slim-bindings

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

FAQPage Schema
How do I bind a specific Android Kotlin API to C# without pulling in the entire Maven dependency tree?

To bind specific Android Kotlin APIs, create a slim Native Library Interop wrapper that exposes only the required functionality, then map the necessary Maven artifacts to their corresponding NuGet bindings to avoid pulling in the full dependency tree.

What is the best way to handle transitive Maven dependencies when creating .NET MAUI Android bindings?

Handling transitive Maven dependencies requires analyzing the full Gradle dependency tree, mapping Maven artifacts to existing NuGet bindings, and configuring MSBuild items like AndroidMavenLibrary or AndroidIgnoredJavaDependency to resolve missing or conflicting packages.

Can I use Metadata.xml transforms to fix naming conflicts in generated .NET for Android bindings?

Yes, you can use Transforms/Metadata.xml to rename namespaces, adjust parameters, and remove problematic types from the generated C# API surface, ensuring the bound Android library integrates cleanly into .NET MAUI without compilation conflicts.

Does .NET MAUI support generating Java wrapper AARs for Native Library Interop?

.NET MAUI supports Native Library Interop by generating a thin Java or Kotlin wrapper AAR that defines marshallable types and callback interfaces, exposing only the selected Android APIs to C#.

Why does my Android binding project fail to compile after updating a native SDK?

Android binding compilation failures after an SDK update often stem from changed transitive dependencies or API signatures; resolving this requires rebuilding the wrapper AAR, refreshing Maven dependencies, and iterating on Metadata.xml transforms.

When do I need to configure AndroidMavenLibrary or AndroidLibrary MSBuild items for .NET Android bindings?

You need to configure AndroidMavenLibrary or AndroidLibrary MSBuild items when your slim binding wrapper depends on external AndroidX, Kotlin, or Maven artifacts that must be resolved and packaged correctly during the .NET MAUI build process.