This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 133
An error occurred while reading data from the ADB stream #160
Comments
Are you reading adb logs? |
Yes! I'm calling method RunLogServiceAsync(). This is my code public async Task StartListenToDeviceAsync()
{
_adbServer.StartServer(AdbPath, false);
var devicesList = _adbClient.GetDevices();
var sb = new StringBuilder();
var i = 0;
foreach (var deviceData in devicesList)
{
i++;
sb.AppendLine($"#{i}\tname {deviceData.Name} / model {deviceData.Model} / product {deviceData.Product}");
}
_logger.WithCaller().Information($"Devices connected:\r\n{sb}");
var device = _adbClient.GetDevices().FirstOrDefault();
if (device == null)
{
_logger.WithCaller().Error("No devices");
return;
}
// Local function
void MessageCallback(LogEntry logEntry)
{
try
{
var androidLogEntry = logEntry as AndroidLogEntry;
if (androidLogEntry?.Tag == "Ruby")
{
var message = androidLogEntry.Message;
// Filter message contain OTP string
if (message.Contains("title=otp"))
{
var otp = FilterMessage(message, "body=", ", title=otp");
_logger.WithCaller().Information($"OTP logged: {otp}");
return;
}
}
}
catch (Exception e)
{
_logger.WithCaller().Error(e, "An error occurred while reading callback");
}
}
await _adbClient.RunLogServiceAsync(device, MessageCallback, CancellationToken.None).ConfigureAwait(false);
} |
@quamotion @qmfrederik Can you help me! |
Anyone can fix it, I have same problem |
It's a known problem. I haven't had time to investigate this yet. PRs are welcome. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
An error occurred while reading data from the ADB stream. Although the header size was expected to be 0x18, a header size of 0x696F was sent by the device
See picture
The text was updated successfully, but these errors were encountered: