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

MAUI Sample Android - allow for Debug on physical devices #3748

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bricefriha
Copy link
Collaborator

Added Android runtime identifiers in the Maui Sample config to allow debugging from a physical Android device.
When debugging, it's often more handy to use a physical device over an emulator. Until now, it was only possible to do it with an iOS device.
It's only logical to add this for Android as well.

#skip-changelog

@bricefriha bricefriha marked this pull request as ready for review November 12, 2024 19:22
@@ -7,6 +7,7 @@
On Windows, we'll also build for Windows 10.
-->
<TargetFrameworks>net8.0-android</TargetFrameworks>
<RuntimeIdentifiers Condition="$(TargetFramework.Contains('-android'))">android-arm;android-arm64;android-x86;android-x64</RuntimeIdentifiers>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that what this group of properties is doing?

<RuntimeIdentifier Condition="'$(TargetPlatformIdentifier)' == 'android' And '$(OSArchitecture)' == 'Arm64'">android-arm64</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(TargetPlatformIdentifier)' == 'ios' And '$(_IsPublishing)' == 'true'">ios-arm64</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(TargetPlatformIdentifier)' == 'ios' And '$(OSArchitecture)' == 'Arm64' And '$(_IsPublishing)' != 'true'">iossimulator-arm64</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(TargetPlatformIdentifier)' == 'maccatalyst' And '$(OSArchitecture)' == 'Arm64'">maccatalyst-arm64</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(TargetPlatformIdentifier)' == 'android' And '$(OSArchitecture)' == 'x64'">android-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(TargetPlatformIdentifier)' == 'ios' And '$(OSArchitecture)' == 'x64' And '$(_IsPublishing)' != 'true'">iossimulator-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(TargetPlatformIdentifier)' == 'maccatalyst' And '$(OSArchitecture)' == 'x64'">maccatalyst-x64</RuntimeIdentifier>

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, my bad I didn't notice the line <RuntimeIdentifier Condition="'$(TargetPlatformIdentifier)' == 'android' And '$(OSArchitecture)' == 'Arm64'">android-arm64</RuntimeIdentifier> for some reasons

However it doesn't work at all on my side

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not on windows at least

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any context? Like error messages etc.?

Might also be worth trying with the version-5.0.0 branch since there are quite a few changes (to support net9.0) in that branch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any context? Like error messages etc.?

I'm getting ADB0020: Mono.AndroidTools.IncompatibleCpuAbiException: The package does not support the CPU architecture of this device.

Might also be worth trying with the version-5.0.0 branch since there are quite a few changes (#3699) in that branch.

I'm gonna try that

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only difference between what you're trying to do in this PR and what already happens in the Samples project is you're adding android-arm and android-x86... so possibly just need to tweak the existing code block to cater to whichever of those allows you to run the sample of the particular physical you're trying to deploy to.

Would be good to keep this in the same styles as all the others.

@bricefriha bricefriha marked this pull request as draft November 13, 2024 10:50
@bricefriha bricefriha marked this pull request as ready for review November 21, 2024 15:50
@bricefriha bricefriha marked this pull request as draft November 21, 2024 17:15
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