AdvancedSharpAdbClient is a .NET library that allows .NET, Mono and Unity applications to communicate with Android devices. It's improved version of SharpAdbClient.
I'm using the adb server included with the Android platform tools.
Android Debug Bridge version 1.0.41
Version 33.0.3-8952118
Host project is .NET 4.8.1, code is as follows
var adb = new AdbClient();
var devices = (await adb.GetDevicesAsync()).ToArray();
if (devices.Length > 0)
{
var device = devices[0];
var client = device.CreateDeviceClient();
var receiver = new ConsoleOutputReceiver();
await adb.ExecuteRemoteCommandAsync("pm list packages -f -3", device, receiver);
var pmOutput = receiver.ToString();
var match = Regex.Match(pmOutput, @"^package:(.*?)=com.beatgames.beatsaber\r?$", RegexOptions.Multiline);
if (!match.Success)
{
MessageBox.Show("Beat Saber not found", "Not Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
var beatSaberPath = match.Groups[1].ToString();
using (var service = new SyncService(adb, device))
{
var files = await service.GetDirectoryListingAsync("/sdcard/Android/obb/com.beatgames.beatsaber");
var dlcTemp = new EasyTempFolder("dlc", Program.TempFolder);
var apkTemp = new EasyTempFolder("apk", Program.TempFolder);
Program.Disposables.Add(dlcTemp);
Program.Disposables.Add(apkTemp);
var localApkPath = Path.Combine(apkTemp, "beatsaber.apk");
using (var localFile = File.Create(localApkPath))
{
await service.PullAsync(beatSaberPath, localFile, null);
}
}
}
From my understanding of the documentation, this should work, but it doesn't. Pulling with adb.exe does however.
Describe the bug
I'm using the adb server included with the Android platform tools.
Host project is .NET 4.8.1, code is as follows
From my understanding of the documentation, this should work, but it doesn't. Pulling with adb.exe does however.
Steps to reproduce the bug
Use provided code with Android emulator.
Expected behavior
No response
Screenshots
No response
NuGet package version
3.1.10
.NET Platform
.NET Framework 4.8.x
Platform type
Windows
System version
No response
IDE
Visual Studio 2022
Additional context
No response