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

Error on archiving .net7.0 for android with target platform ARM32: "Invalid option 'ARM32' for /platform; must be anycpu, x86, Itanium, arm, arm64" #15691

Closed
vsfeedback opened this issue Jun 16, 2023 · 6 comments
Labels
area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging partner/android Issues for the Android SDK platform/android 🤖 t/bug Something isn't working

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


Error on archiving apk using .net 7.0 for android with “Target platform” ARM32
Error message says “Invalid option ‘ARM32’ for /platform; must be anycpu, x86, Itanium, arm, arm64”
Latest visual studio 2022 17.6.2

I tried editing the project file manually and setting the value to “ARM” instead of “ARM32” and it archived but produced 3 MB apk that crashes on open.


Original Comments

Feedback Bot on 6/14/2023, 08:08 PM:

(private comment, text removed)

Nina Chen [MSFT] on 6/14/2023, 11:39 PM:

(private comment, text removed)

Feedback Bot on 6/14/2023, 11:40 PM:

(private comment, text removed)

Feedback Bot on 6/15/2023, 10:28 AM:

(private comment, text removed)


Original Solutions

(no solutions)

@MSLukeWest
Copy link
Contributor

The repro steps for this are pretty simple:

  1. New MAUI app
  2. Switch platform from AnyCPU to ARM32
  3. Build

Result: Build Error

APPX0504 Unsupported $(Platform) property value 'ARM32'. .nuget\packages\microsoft.windowsappsdk\1.3.230502000\buildTransitive\Microsoft.Build.Msix.Packaging.targets 1648

This is a MAUI SDK bug, the error comes from the WinAppSdk targets, but it's because they don't handle "ARM32" as a platform, just "ARM". We should probably transform ARM32 to ARM before passing it to their targets.

I confirmed that this reproes on both .NET 7.0 / WinAppSDK 1.2 and .NET 8.0 / WinAppSDK 1.3. I've included binlogs for both in the attached zip.

MAUI_Arm32_Failure.zip

@jsuarezruiz jsuarezruiz added platform/android 🤖 area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging labels Jun 16, 2023
@mosammo
Copy link

mosammo commented Jun 22, 2023

This is a showstopper for some projects and the fix should be very easy and quick. please give it priority.

@MSLukeWest
Copy link
Contributor

@jsuarezruiz I see you added the Android tag based on the title, but this bug actually blocks building arm32 for all platforms. Please help route as appropriate for .NET 8. cc @mattleibow

@mosammo
Copy link

mosammo commented Jul 10, 2023

Finally found a workaround: in android project properties "platform target" select "ARM64" (not ARM32) then edit the project file manually and change the "RuntimeIdentifiers" tag as follows:
<RuntimeIdentifiers>android-arm;</RuntimeIdentifiers>
This will result in an apk that targets ARM32 without ARM64 assemblies.
dotnet/android#8168 (comment)

@dellis1972
Copy link
Contributor

@mosammo the PlatformTarget can be left as AnyCPU. There is not need to change it to ARM64.

@samhouts samhouts added the t/bug Something isn't working label Jul 31, 2023
@mattleibow mattleibow added the partner/android Issues for the Android SDK label Nov 8, 2023
@mattleibow
Copy link
Member

I believe it is not a workaround to set the RuntimeIdentifiers, it is the correct way. Platform is no longer the correct way to change the platform (yeah I know) in .NET 6+.

Closing this as Platform is obsolete, RuntimeIdentifier is the new way. This can also be seen with the CLI args, there is no way to provide platform easily, but there is -r for Runtime Identifiers.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging partner/android Issues for the Android SDK platform/android 🤖 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants