.net SDK 8 Android 项目构建日志显示以下错误并创建所有 ABI 组合构建。
/usr/local/share/dotnet/sdk/8.0.303/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(154,5): message NETSDK1084: There is no application host available for the specified RuntimeIdentifier 'android-arm'.
/usr/local/share/dotnet/sdk/8.0.303/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(154,5): message NETSDK1084: There is no application host available for the specified RuntimeIdentifier 'android-arm64'.
我的 .csproj 配置
<TargetFramework>net8.0-android</TargetFramework>
<SupportedOSPlatformVersion>29</SupportedOSPlatformVersion>
<OutputType>Exe</OutputType>
<Nullable>disable</Nullable>
<ImplicitUsings>disable</ImplicitUsings>
<BuildWithMSBuildOnMono>false</BuildWithMSBuildOnMono>
<RuntimeIdentifiers>android-arm;android-arm64</RuntimeIdentifiers>
<AndroidApplication>true</AndroidApplication>
我只想为arm64-v8a和armabi-v7a构建,即.net中的“android-arm64”和“android-arm”作为“RuntimeIdentifier”。
为什么有以下几行?
<BuildWithMSBuildOnMono>false</BuildWithMSBuildOnMono>
<AndroidApplication>true</AndroidApplication>.
我从未在 net8-android 项目中见过它们。
<RuntimeIdentifiers>android-arm;android-arm64</RuntimeIdentifiers>
适合您想要的。