ApkHealthLib 1.0.1

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package ApkHealthLib --version 1.0.1
                    
NuGet\Install-Package ApkHealthLib -Version 1.0.1
                    
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="ApkHealthLib" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ApkHealthLib" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="ApkHealthLib" />
                    
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 ApkHealthLib --version 1.0.1
                    
#r "nuget: ApkHealthLib, 1.0.1"
                    
#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 ApkHealthLib@1.0.1
                    
#: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=ApkHealthLib&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=ApkHealthLib&version=1.0.1
                    
Install as a Cake Tool

ApkHealthLib

ApkHealthLib is a lightweight .NET library that executes an embedded PowerShell script to analyze and measure the runtime health and performance characteristics of Android applications (APKs). It provides a clean, programmatic C# API suitable for automation, QA, and CI/CD pipelines.

The library is packaged as a NuGet package and supports both modern .NET and legacy .NET Framework environments.


📌 Key Features

  • ✅ Executes an embedded PowerShell (.ps1) script (no external files required)
  • ✅ Simple and reusable C# API
  • ✅ Supports APK performance checks:
    • Cold start analysis
    • Warm start analysis
    • Frame statistics collection
    • Optional reset of performance stats
  • ✅ Multi‑targeted support:
    • .NET 8 (PowerShell 7)
    • .NET Framework 4.7.2 (Windows PowerShell 5.1)
  • ✅ Designed for:
    • Test automation frameworks
    • Performance testing tools
    • Continuous Integration (CI) pipelines
    • Software Quality Assurance workflows

🧱 Architecture Overview

ApkHealthLib embeds a PowerShell script (Scripts/ApkHealth.ps1) directly into the compiled assembly as an embedded resource.

At runtime, the library:

  1. Loads the embedded PowerShell script
  2. Executes it using System.Management.Automation
  3. Passes parameters from C# to PowerShell
  4. Collects and returns the script output as structured results

This approach:

  • Avoids PowerShell execution‑policy issues
  • Eliminates dependency on external script files
  • Ensures portability and reliability

📦 Installation

Install from NuGet:

dotnet add package ApkHealth

Or via Visual Studio:

  • Right‑click project → Manage NuGet Packages
  • Search for ApkHealth
  • Install

🚀 Usage Example

using ApkHealthLib;

var checker = new ApkHealthChecker();

var results = checker.CheckApk(
    packageName: "com.example.myapp",
    resetStats: true,
    useFrameStats: true,
    coldStartCount: 2,
    warmStartCount: 3
);

foreach (var line in results)
{
    Console.WriteLine(line);
}

🧪 API Reference

CheckApk(...)

string[] CheckApk(
    string packageName,
    bool resetStats,
    bool useFrameStats,
    int coldStartCount,
    int warmStartCount
)
Parameters
Parameter Description
packageName Android package name (e.g. com.example.app)
resetStats Whether to reset performance statistics before testing
useFrameStats Whether to collect frame rendering statistics
coldStartCount Number of cold start runs
warmStartCount Number of warm start runs
Returns
  • string[] — Output lines produced by the PowerShell script

⚙️ Requirements

System Requirements

  • ✅ Windows OS
  • ✅ ADB (Android Debug Bridge) installed and available in PATH
  • ✅ Android device or emulator connected

PowerShell Requirements

Target Framework PowerShell
.NET 8 PowerShell 7+
.NET Framework 4.7.2 Windows PowerShell 5.1

🧩 Target Frameworks

This library is multi‑targeted:

net8.0
net472

NuGet automatically selects the appropriate assembly for your project.


🛠 Development Notes

  • The PowerShell script is embedded using EmbeddedResource
  • No runtime identifier (RID) is required for class library packaging
  • The project is compatible with modern SDK‑style builds
  • Designed to work cleanly with dotnet build and dotnet pack

🧰 Troubleshooting

  • NU5026: File to be packed not found – Clean bin/ and obj/ folders and run a fresh dotnet build before dotnet pack.
  • C# language version issues on net472 – Set <LangVersion>8.0</LangVersion> for net472 and disable implicit usings there.
  • GlobalUsings.g.cs errors on net472 – Disable implicit usings for net472 to avoid C# 10 features in that target.
  • RID warnings on .NET 8 – Prefer portable RIDs (e.g., win-x64) and update dependencies. Use <UseRidGraph>true</UseRidGraph> only as a temporary workaround.

📄 License

MIT License


👤 Author

Mohai Minul Islam
Software Quality Assurance Engineer
Dhaka, Bangladesh

⭐ Why ApkHealthLib?

ApkHealthLib bridges the gap between PowerShell‑based Android tooling and modern .NET automation, enabling QA engineers and developers to run repeatable, script‑driven APK performance checks directly from C#.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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 Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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

ApkHealthLib v1.0.1 is the first stable release of a .NET library for analyzing Android APK health and performance using an embedded PowerShell script.

This release provides a clean C# API for running cold start, warm start, and frame statistics analysis without requiring external script files. The library supports both .NET 8 (PowerShell 7) and .NET Framework 4.7.2 (Windows PowerShell 5.1), making it suitable for modern and legacy automation environments.

Designed for QA automation, CI pipelines, and performance testing workflows.