ApkNet 1.0.0
dotnet add package ApkNet --version 1.0.0
NuGet\Install-Package ApkNet -Version 1.0.0
<PackageReference Include="ApkNet" Version="1.0.0" />
paket add ApkNet --version 1.0.0
#r "nuget: ApkNet, 1.0.0"
// Install ApkNet as a Cake Addin #addin nuget:?package=ApkNet&version=1.0.0 // Install ApkNet as a Cake Tool #tool nuget:?package=ApkNet&version=1.0.0
apk-net
.NET library written in C# for reading/parsing APK manifest (AndroidManifest.xml) and resource data (Resources.arsc).
Project Info
This project originaly forked from hylander0/Iteedee.ApkReader.
All namespaces are changed and started to maintain actively.
Using the ApkReader Library
The library handles everything after you have uncompressed/unzipped the APK using your choice tool or library. I have used the [ICSharpCode.SharpZipLib][5] library to uncompressed the APK in my example.
Below I am uncompromising the AndroidManifest.xml and Resources.arsc files and passing the byte array data to the ApkReader library:
byte[] manifestData = null;
byte[] resourcesData = null;
using (ICSharpCode.SharpZipLib.Zip.ZipInputStream zip = new ICSharpCode.SharpZipLib.Zip.ZipInputStream(File.OpenRead(path)))
{
using (var filestream = new FileStream(path, FileMode.Open, FileAccess.Read))
{
ICSharpCode.SharpZipLib.Zip.ZipFile zipfile = new ICSharpCode.SharpZipLib.Zip.ZipFile(filestream);
ICSharpCode.SharpZipLib.Zip.ZipEntry item;
while ((item = zip.GetNextEntry()) != null)
{
if (item.Name.ToLower() == "androidmanifest.xml")
{
manifestData = new byte[50 * 1024];
using (Stream strm = zipfile.GetInputStream(item))
{
strm.Read(manifestData, 0, manifestData.Length);
}
}
if (item.Name.ToLower() == "resources.arsc")
{
using (Stream strm = zipfile.GetInputStream(item))
{
using (BinaryReader s = new BinaryReader(strm))
{
resourcesData = s.ReadBytes((int)item.Size);
}
}
}
}
}
}
After you have uncompressed and extracted the necessary data, simply pass in the data objects and it returns an APKInfo object.
ApkReader apkReader = new ApkReader();
ApkInfo info = apkReader.extractInfo(manifestData, resourcesData);
APKInfo object contains all of the meta-data for that APK.
Console.WriteLine(string.Format("Package Name: {0}", info.packageName));
Console.WriteLine(string.Format("Version Name: {0}", info.versionName));
Console.WriteLine(string.Format("Version Code: {0}", info.versionCode));
Console.WriteLine(string.Format("App Has Icon: {0}", info.hasIcon));
if(info.iconFileName.Count > 0)
Console.WriteLine(string.Format("App Icon: {0}", info.iconFileName[0]));
Console.WriteLine(string.Format("Min SDK Version: {0}", info.minSdkVersion));
Console.WriteLine(string.Format("Target SDK Version: {0}", info.targetSdkVersion));
if (info.Permissions != null && info.Permissions.Count > 0)
{
Console.WriteLine("Permissions:");
info.Permissions.ForEach(f =>
{
Console.WriteLine(string.Format(" {0}", f));
});
}
else
Console.WriteLine("No Permissions Found");
Console.WriteLine(string.Format("Supports Any Density: {0}", info.supportAnyDensity));
Console.WriteLine(string.Format("Supports Large Screens: {0}", info.supportLargeScreens));
Console.WriteLine(string.Format("Supports Normal Screens: {0}", info.supportNormalScreens));
Console.WriteLine(string.Format("Supports Small Screens: {0}", info.supportSmallScreens));
Special Thanks
Forked project originaly developed by Justin Hyland and bug fixes from KK GUO.
Product | Versions 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- 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 | 23,926 | 10/13/2018 |