android: Can't build .NET 7 android projects
Android application type
.NET Android (net7.0-android, etc.)
Affected platform version
VS 2022 17.5.3, .NET SDK 7.0.200, osx.13-arm64, Mono 6.12.0.188
Description
Can’t build .NET 7.0 android project, newly created from template in visual studio. If i change to .net6.0-android however, it will build.
Csproj:
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net7.0-android</TargetFramework> <SupportedOSPlatformVersion>23</SupportedOSPlatformVersion> <OutputType>Exe</OutputType> <Nullable>enable</Nullable> <ImplicitUsings>enable</ImplicitUsings> <ApplicationId>com.companyname.AndroidApp1</ApplicationId> <ApplicationVersion>1</ApplicationVersion> <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion> <TargetFrameworkVersion>v11.0</TargetFrameworkVersion> </PropertyGroup>
My system:
.NET SDK: Version: 7.0.202 Commit: 6c74320bc3
Runtime Environment: OS Name: Mac OS X OS Version: 13.3 OS Platform: Darwin RID: osx.13-arm64 Base Path: /usr/local/share/dotnet/sdk/7.0.202/
Host: Version: 7.0.4 Architecture: arm64 Commit: 0a396acafe
.NET SDKs installed: 6.0.407 [/usr/local/share/dotnet/sdk] 7.0.202 [/usr/local/share/dotnet/sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 6.0.15 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.15 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found: x64 [/usr/local/share/dotnet/x64] registered at [/etc/dotnet/install_location_x64]
Environment variables: Not set
global.json file: Not found
Workloads:
Installed Workload Id Manifest Version Installation Source
wasm-tools 7.0.4/7.0.100 SDK 7.0.200 macos 13.1.1040/7.0.100 SDK 7.0.200 maui-maccatalyst 7.0.59/7.0.100 SDK 7.0.200 maui-ios 7.0.59/7.0.100 SDK 7.0.200 maui-android 7.0.59/7.0.100 SDK 7.0.200 tvos 16.1.1537/7.0.100 SDK 7.0.200 android 33.0.26/7.0.100 SDK 7.0.200
Steps to Reproduce
- Install android workload
- Create .NET android project from visual studio template
-
- Build solution (either via visual studio or command line)
Did you find any workaround?
No
Relevant log output
Xamarin.Android.Common.targets(3,3): Error XA3006: Could not compile native assembly file: environment.arm64-v8a.ll
stderr | /usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.26/tools/Darwin/binutils/bin/llc: error: /usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.26/tools/Darwin/binutils/bin/llc: environment.arm64-v8a.ll:554:7: error: expected value token
stderr | i32 −1, ; apk_fd
(XA3006) (AndroidApp1)
Xamarin.Android.Common.targets(1979, 3): [XA3006] Could not compile native assembly file: environment.x86.ll
stderr | /usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.26/tools/Darwin/binutils/bin/llc: error: /usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.26/tools/Darwin/binutils/bin/llc: environment.x86.ll:593:7: error: expected value token
stderr | i32 −1, ; apk_fd
Xamarin.Android.Common.targets(1979, 3): [XA3006] Could not compile native assembly file: environment.armeabi-v7a.ll
stderr | /usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.26/tools/Darwin/binutils/bin/llc: error: /usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.26/tools/Darwin/binutils/bin/llc: environment.armeabi-v7a.ll:593:7: error: expected value token
stderr | i32 −1, ; apk_fd
Xamarin.Android.Common.targets(1979, 3): [XA3006] Could not compile native assembly file: environment.x86_64.ll
stderr | /usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.26/tools/Darwin/binutils/bin/llc: error: /usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.26/tools/Darwin/binutils/bin/llc: environment.x86_64.ll:593:7: error: expected value token
stderr | i32 −1, ; apk_fd
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 25 (14 by maintainers)
Commits related to this issue
- Fix integer to string conversion when generating code Fixes: https://github.com/xamarin/xamarin-android/issues/7939 Context: https://github.com/dotnet/runtime/issues/13363 Context: https://www.unicod... — committed to grendello/xamarin-android by grendello 4 years ago
- [Xamarin.Android.Build.Tasks] Fix `-int.ToString()` for locales (#7941) Fixes: https://github.com/xamarin/xamarin-android/issues/7939 Context: https://github.com/dotnet/runtime/issues/13363 Conte... — committed to dotnet/android by grendello 4 years ago
- [Xamarin.Android.Build.Tasks] Fix `-int.ToString()` for locales (#7941) Fixes: https://github.com/xamarin/xamarin-android/issues/7939 Context: https://github.com/dotnet/runtime/issues/13363 Conte... — committed to dotnet/android by grendello 4 years ago
@rhult precisely the encoding that causes the problem then. We have the answer, now off to fix it 😃 The fix is simple, but you might want to work around the problem by using
LANG=en_SE.UTF-8when compiling in the meantime.If you build from command line, you can just do:
@grendello Thank you. It worked like a charm when I added it to .zshrc 😃 Great job!
@mrhenkiz you can put
in the
.profilefile in your home directory, then that value ofLANGwill be used for all terminal sessions. For GUI apps you’d either have to use thedefaultsutility (from terminal, dodefaults read | lessto see all the settings) or change the language in the macOS settings app.