'XA5104 Could not locate the Android NDK

XA5104: Could not locate the Android NDK. Please make sure the Android NDK is installed in the Android SDK Manager, or if using a custom NDK path, please ensure the $(AndroidNdkDirectory) MSBuild property is set to the custom path.

The NDK location is set to the ndk within the android sdk but still this shows up



Solution 1:[1]

All the answers above are valid.

But in case you can't change the default location of the Android NDK through the settings (it was my case, I think it's a Windows 11 problem as surprising as it may sound):

  • Make sure you installed NDK, if not: Tools > Android > Android SDK manager > Tools > select NDK > Apply Changes

  • Create a folder named "AndroidNDK64" in C:\ProgramData\Microsoft

  • Move the C:\Microsoft\AndroidNDK\android-ndk-... folder to the folder you just created

It worked for me and I hope it works for you too ?

Solution 2:[2]

I came across this issue and it turned out to have nothing to do with the Android NDK. I was trying to deploy a debug version of my app on top of a release build, changing back to debug or uninstalling my app solved the problem.

Solution 3:[3]

happens to me after updating VS 2019 to Version 16.11.5 two days ago, it happens before AND after I install ndk from Android SDK Manager, and Android NDK Location setting is NOT in VS Options->Xamarin->Android Setting, check this FAQ https://docs.microsoft.com/en-us/xamarin/android/troubleshooting/questions/android-sdk-location?tabs=windows

Solution 4:[4]

I had same issue just reverted to version 21.4.702 and everyting started to work

Solution 5:[5]

Had the same issue on Visual Studio for Mac. Downgrading to 21.4.7075529 allowed the Android project to build and deploy.

Solution 6:[6]

I had the same issue and fixed it by adding the NDK manually. Please follow the steps down below.

  1. Make sure that you have already installed NDK from Visual Studio's Android SDK Manager window.
  2. Copy "ndk-bundle" folder from "C:\Program Files (x86)\Android\android-sdk"
  3. Paste it under the "C:\ProgramData\Microsoft\AndroidNDK64" path.
  4. Rename the pasted "ndk-bundle" folder to "android-ndk-r21"

Finally, run the project and enjoy.

Solution 7:[7]

just toasted this problem and suggestions here either outdated or makes less sense. You dont need to separately install NDK, VS22 is deliviring it together with SDK installation. So there is a folder called NDKbundle under the SDK folder. Only problem here is that you need to make sure that you have the correct NDK. You cannot use latest version of NDK if you arent using everything up to date and if you comply with the NDK criterias. Here you can find the history

https://developer.android.com/ndk/downloads/revision_history

For example, if you are NDK23 you cannot use if you target APIs 16, 17, and 18 as it is stated in the release notes "Jelly Bean (APIs 16, 17, and 18) will not be supported in the next NDK release. ".

For me was the case, I had recently VS22 repair and somehow, SDK installed the latest version of NDK and i was getting this error. Once i downgraded back to NDK21 version, it worked like a charm.

Solution 8:[8]

I was getting this error after changing to a Release build and trying to deploy. I tried the other answers and made sure the app was not present on the device. Nothing worked.

What did work, was opening the Android SDK manager and uninstalling the NDK and then re-installing.

After that, I was able to deploy the Release config of the app with no problem.

This was VS2019 for Windows 10.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Muhammad Khan
Solution 3
Solution 4 valentasm
Solution 5 Igor Moiseev
Solution 6 MURAT BALTACIO?LU
Solution 7 Emil
Solution 8