Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The server returned an invalid sync response 0 when trying to pull. #97

Open
DanTheMan827 opened this issue Mar 10, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@DanTheMan827
Copy link

DanTheMan827 commented Mar 10, 2024

Describe the bug

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.

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

@DanTheMan827 DanTheMan827 added the bug Something isn't working label Mar 10, 2024
@wherewhere
Copy link
Member

You can only use SyncService onetime. If it returns 0, you need to ReOpen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants