镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Xamarin.Android project not building when using NDK r-22 #5526

Closed

Description

@lwschan

Recently, some changes were made to the macOS image, updating the Android NDK bundle from r-21 to r-22. Ever since the update, many Xamarin.Android projects have had problems building.

Refer to https://developercommunity2.visualstudio.com/t/error-xa5101-platform-library-directory-for-target/1313156?from=email and actions/runner-images#2481 and actions/runner-images#2481

In the Microsoft Developer Community thread, a solution provided by one of the commetors is to install NDK r-21 manually, and use msbuildArguments in the Xamarin.Android build task to force it to choose the NDK installed. This step cannot work for App Center, because App Center does not allow us to pass in any argument for the build task.

Is there a way to force Xamarin.Android project to use the newest NDK version installed? Instead of trying to use an old one. We are not targetting any specific NDK version in our app, I also couldn't find a config to change it. So I am not sure why the build task is trying to use such an old version.

Tested using Xamarin.Android 11.1 and 10.3, same result.

Steps to Reproduce

  1. Create a Xamarin.Android project
  2. Create a pipeline on Azure/App Center that builds the project
  3. Build using the pipeline

Expected Behavior

Build without error.

Actual Behavior

(_BuildApkEmbed target) -> 
  /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2099,3): error : error XA5101: Platform library directory for target Arm and API Level 4 was not found. Expected path is "/Users/runner/Library/Android/sdk/ndk-bundle/platforms/android-4/arch-arm/usr/lib" [/Users/runner/work/1/s/MobileApp/MobileApp.Droid/MobileApp.Droid.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2099,3): error :   at Java.Interop.Tools.Diagnostics.Diagnostic.Error (System.Int32 code, System.String message, System.Object[] args) [0x00008] in <a01ded9e489d49e3902da78cd983b642>:0  [/Users/runner/work/1/s/MobileApp/MobileApp.Droid/MobileApp.Droid.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2099,3): error :   at Xamarin.Android.Tasks.Aot+<GetAotConfigs>d__80.MoveNext () [0x00393] in <3e53085892e04b628169d0ea2d9ff8b6>:0  [/Users/runner/work/1/s/MobileApp/MobileApp.Droid/MobileApp.Droid.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2099,3): error :   at Xamarin.Android.Tasks.AsyncTaskExtensions.WhenAllWithLock[TSource] (Xamarin.Build.AsyncTask asyncTask, System.Collections.Generic.IEnumerable`1[T] source, System.Action`2[T1,T2] body) [0x0006e] in <3e53085892e04b628169d0ea2d9ff8b6>:0  [/Users/runner/work/1/s/MobileApp/MobileApp.Droid/MobileApp.Droid.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2099,3): error :   at Xamarin.Android.Tasks.Aot.RunTaskAsync () [0x000a9] in <3e53085892e04b628169d0ea2d9ff8b6>:0  [/Users/runner/work/1/s/MobileApp/MobileApp.Droid/MobileApp.Droid.csproj]

Activity

  1. grendello commented on Jan 20, 2021

    @grendello
    Contributor

    Hi @LewisGauss! Please use the workaround described here #5499 (comment). We are aware of the issue and we are working to implement a workaround (until NDK r22 is fixed) for this issue. Thanks!

  2. ghost locked as resolved and limited conversation to collaborators on Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: App+Library BuildIssues when building Library projects or Application projects.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions