Skip to content

Conversation

@jonathanpeppers
Copy link
Member

@jonathanpeppers jonathanpeppers commented Jan 28, 2026

I found two issues testing dotnet run:

  • If you have two devices connected, first is an arm64 device, second is x86_64 emulator.

Issue 1

  • The _ResolveMonoAndroidSdks MSBuild target sets $(AdbTarget) based on $(Device) global MSBuild property.

  • The _GetPrimaryCpuAbi MSBuild target runs first and doesn't have the correct value for $(AdbTarget)!

I fixed this by setting $(AdbTarget) late during evaluation, in Xamarin.Android.Common.targets.

Issue 2

In 105d912, I added Microsoft.Android.Run project to make dotnet run show live adb logcat output.

Unfortunately, I forgot to add a switch for "adb target", so it did not properly select a device.

Added the --adb-target switch to fix this.

I found two issues testing `dotnet run`:

* If you have two devices connected, first is an arm64 device, second
  is x86_64 emulator.

~~ Issue 1 ~~

* The `_ResolveMonoAndroidSdks` MSBuild target sets `$(AdbTarget)`
  based on `$(Device)` global MSBuild property.

* The `_GetPrimaryCpuAbi` MSBuild target runs *first* and doesn't have
  the correct value for `$(AdbTarget)`!

~~ Issue 2 ~~

In 105d912, I added `Microsoft.Android.Run` project to make `dotnet
run` show live `adb logcat` output.

Unfortunately, I forgot to add a switch for "adb target", so it did
not properly select a device.

Added the `--adb-target` switch to fix this.
@jonathanpeppers
Copy link
Member Author

New test is working:

image

@jonathanpeppers jonathanpeppers marked this pull request as ready for review January 29, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants