.NET for Android 錯誤 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 的專案必須在屬性中更新以移除它,才能成功使用新版 .NET for Android 進行建置。 現在應該改用較新的 Armeabi-v7a ABI。

armeabi該值可透過直接編輯 .csproj 或在 Windows 或 macOS 的 Visual Studio 屬性頁面更新設定來移除。

更新 Windows 設定

  1. 在解決方案總管中選擇專案並點選屬性圖示,或右鍵點擊專案並選擇屬性。

  2. 在側邊窗格選擇 Android 選項。

  3. 選取 [進階] 按鈕。

  4. 支援架構清單中已不再包含 armeabi 的勾選框,因此要移除舊的 armeabi 設定,請取消並重新勾選其他 ABI,點擊關閉按鈕,然後儲存變更。

    Visual Studio 進階 Android 選項視窗中的支援架構列表

更新 macOS 上的設定

  1. 在解決方案面板中,按住 Control 鍵並點擊專案,然後選擇選項。

  2. 在側邊窗格選擇 Android Build。

  3. 選取 進階 標籤。

  4. 在 支援的 ABI 清單中,取消勾選 armeabi 的勾選框,然後點擊 確定 按鈕來儲存變更。

    Visual Studio for Mac Android 建置進階標籤中的支援 ABI 列表