ApkHealthLib 1.0.1
dotnet add package ApkHealthLib --version 1.0.1
NuGet\Install-Package ApkHealthLib -Version 1.0.1
<PackageReference Include="ApkHealthLib" Version="1.0.1" />
<PackageVersion Include="ApkHealthLib" Version="1.0.1" />
<PackageReference Include="ApkHealthLib" />
paket add ApkHealthLib --version 1.0.1
#r "nuget: ApkHealthLib, 1.0.1"
#:package ApkHealthLib@1.0.1
#addin nuget:?package=ApkHealthLib&version=1.0.1
#tool nuget:?package=ApkHealthLib&version=1.0.1
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:
- Loads the embedded PowerShell script
- Executes it using
System.Management.Automation - Passes parameters from C# to PowerShell
- 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 buildanddotnet pack
🧰 Troubleshooting
- NU5026: File to be packed not found – Clean
bin/andobj/folders and run a freshdotnet buildbeforedotnet pack. - C# language version issues on net472 – Set
<LangVersion>8.0</LangVersion>fornet472and disable implicit usings there. - GlobalUsings.g.cs errors on net472 – Disable implicit usings for
net472to 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 | Versions 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. |
-
.NETFramework 4.7.2
- Microsoft.PowerShell.5.1.ReferenceAssemblies (>= 1.0.0)
-
net8.0
- System.Management.Automation (>= 7.3.0)
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.