AxmlNet 1.0.0

dotnet add package AxmlNet --version 1.0.0
                    
NuGet\Install-Package AxmlNet -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AxmlNet" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AxmlNet" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="AxmlNet" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AxmlNet --version 1.0.0
                    
#r "nuget: AxmlNet, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AxmlNet@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AxmlNet&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=AxmlNet&version=1.0.0
                    
Install as a Cake Tool

AxmlNet

.NET Standard 2.1 MIT License

AxmlNet is a high-performance .NET Standard 2.1 library designed to decode Android Binary XML (AXML) files and extract them directly from APK or APKS (Split APK) containers. It supports both binary and plain text XML files with advanced format detection and optimized performance.

🚀 Features

  • Smart Decoding: Automatically detects and decodes Binary AXML or plain text XML formats transparently.
  • APK & APKS Support: Extract XML files seamlessly from standard .apk files and .apks (Split APK) bundles.
  • Specialized Manifest Extraction: Dedicated ApkManifestExtractor for robust extraction and conversion of AndroidManifest.xml files, including handling multi-APK split containers.
  • High-Performance Sniffing: Utilizes ReadOnlySpan<byte> and BinaryPrimitives for zero-allocation, fast header parsing and format identification.

📦 Installation

Install via the .NET CLI:

dotnet add package AxmlNet

🛠 Usage Examples

1. ApkManifestExtractor

Extract and convert manifests from APK or APKS containers, including all splits in a .apks bundle:

// Extract all manifests (for example, from an .apks split APK bundle)
var manifests = ApkManifestExtractor.ExtractBinaryManifests("app.apks");

foreach (var manifest in manifests)
{
    Console.WriteLine($"Manifest extracted from: {manifest.SourceName}");
    string xml = manifest.ConvertToXml();
    Console.WriteLine(xml);
}

// Extract and convert the main manifest from a single APK file
string mainManifestXml = ApkManifestExtractor.ConvertManifestToXml("app.apk");
Console.WriteLine(mainManifestXml);

2. ApkBinaryXmlExtractor

Extract any XML file (layouts, configs) from an APK or APKS:

string xmlContent = ApkBinaryXmlExtractor.GetXmlContent("app.apk", "res/xml/network_security_config.xml");
Console.WriteLine(xmlContent);

3. AxmlConverter

Manually convert a binary AXML stream to a formatted XML string:

using var stream = File.OpenRead("binary_layout.xml");
var options = new AxmlConverterOptions { Indent = true, WriteXmlDeclaration = true };

string xml = AxmlConverter.ConvertToXmlString(stream, options);
Console.WriteLine(xml);

🔍 Technical Details

Binary Header Validation

The library identifies Binary AXML files by validating the Android resource chunk header (ResChunk_header):

  • Chunk Type: 0x0003 (RES_XML_TYPE)
  • Header Size: 0x0008
  • Data Integrity: The internal totalSize field is checked to ensure consistency with the actual byte stream length.

Encoding Heuristics

For non-binary files, AxmlNet applies a heuristic approach to determine the text encoding:

  1. Attempts to detect standard Byte Order Marks (BOM) for UTF-8 and UTF-16 (LE/BE).
  2. If BOM is absent, analyzes the first 512 bytes for null-byte frequency.
  3. If null bytes exceed 10% within the sample, assumes UTF-16 LE encoding; otherwise, defaults to UTF-8.

⚙️ Requirements

  • .NET Standard 2.1
  • Dependencies: System.Memory, System.IO.Compression

<p align="center"><i>Licensed under the MIT License.</i></p>

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 130 2/14/2026