Skip to content

Commit 7d898d2

Browse files
committed
Add additional logging and fallbacks
1 parent 8fde2d0 commit 7d898d2

File tree

1 file changed

+9
-1
lines changed
  • src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities

1 file changed

+9
-1
lines changed

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/DeviceTest.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ public class DeviceTest: BaseTest
2626
protected static bool IsDeviceAttached (bool refreshCachedValue = false)
2727
{
2828
if (string.IsNullOrEmpty (_shellEchoOutput) || refreshCachedValue) {
29+
// run this twice as sometimes the first time returns the
30+
// device as "offline".
31+
RunAdbCommand ("devices");
32+
var devices = RunAdbCommand ("devices");
33+
TestContext.Out.WriteLine ($"LOG adb devices: {devices}");
2934
_shellEchoOutput = RunAdbCommand ("shell echo OK", timeout: 15);
3035
}
3136
return _shellEchoOutput.Contains ("OK");
@@ -58,11 +63,14 @@ public void DeviceSetup ()
5863
DeviceAbi = RunAdbCommand ("shell getprop ro.product.cpu.abilist64").Trim ();
5964

6065
if (string.IsNullOrEmpty (DeviceAbi))
61-
DeviceAbi = RunAdbCommand ("shell getprop ro.product.cpu.abi") ?? RunAdbCommand ("shell getprop ro.product.cpu.abi2");
66+
DeviceAbi = (RunAdbCommand ("shell getprop ro.product.cpu.abi") ?? RunAdbCommand ("shell getprop ro.product.cpu.abi2")) ?? "x86_64";
6267

6368
if (DeviceAbi.Contains (",")) {
6469
DeviceAbi = DeviceAbi.Split (',')[0];
6570
}
71+
} else {
72+
TestContext.Out.WriteLine ($"LOG GetSdkVersion: {DeviceSdkVersion}");
73+
DeviceAbi = "x86_64";
6674
}
6775
} catch (Exception ex) {
6876
Console.Error.WriteLine ("Failed to determine whether there is Android target emulator or not: " + ex);

0 commit comments

Comments
 (0)