适用于 Android 的 .NET 错误 XA0115

示例消息

Invalid value 'armeabi' in $(AndroidSupportedAbis). This ABI is no longer supported. Please update your project properties to remove the old value. If the properties page does not show an 'armeabi' checkbox, un-check and re-check one of the other ABIs and save the changes.

问题

由于 删除 Android NDK r17 中的 armeabi 支持,.NET for Android 9.1 是支持 armeabi 体系结构的最后一个版本。

导致错误的示例 .csproj 文件元素 $(AndroidSupportedAbis)

<AndroidSupportedAbis>armeabi;armeabi-v7a;arm64-v8a</AndroidSupportedAbis>

解决方案

在属性中选用旧 ABI 的项目需要更新以删除该 ABI,然后才能使用较新的 .NET for Android 版本成功生成。 现在应改用较新的 armeabi-v7a ABI。

可以通过直接编辑.csproj文件,或通过在Windows或macOS上的Visual Studio属性页中更新设置,从此属性中删除armeabi值。

更新 Windows 上的设置

  1. 解决方案资源管理器 中选择项目,然后单击 “属性 ”图标,或右键单击该项目并选择“ 属性”。

  2. 在侧窗格中,选择 “Android 选项”。

  3. 选择“高级”按钮。

  4. 支持的体系结构列表不再包含 armeabi 复选框,因此要删除旧的 armeabi 设置,取消检查并重新检查其他 ABI 之一,请单击“关闭”按钮,然后保存更改。

    Visual Studio 高级 Android 选项窗口中支持的体系结构列表

更新 macOS 上的设置

  1. “解决方案 ”板中单击项目,然后选择“ 选项”。

  2. 在侧窗格中,选择 “Android 生成”。

  3. 选择“高级”选项卡。

  4. 支持的 ABIs 列表中,取消选中 armeabi 复选框,然后单击“ 确定 ”按钮保存更改。

    Visual Studio for Mac Android 生成高级选项卡中支持的 ABIs 列表