Unity Android Development

Resolving Missing Android NDK in Unity 2022.1.20f1

When I attempted my first Android build after reinstalling Unity 2022.1.20f1, the console immediately blocked me with a critical error: the Android NDK could not be found. Despite multiple editor re-installations, the expected directory was simply empty.

Need supporting assets, scene references, or production files to test this Unity workflow beyond the article?

Open on 3DCGHub

1. The Symptom and Initial Assessment

My build pipeline for the Quest 2 ground to a halt immediately after I finished a fresh installation of Unity 2022.1.20f1. The editor threw an error claiming the NDK path was invalid, pointing to a directory inside the Editor installation that, upon inspection, was completely missing.

My initial assumption was a corrupt installation package. I performed two clean uninstalls and re-downloads through the Unity Hub, but the NDK subfolder remained absent in the target directory every time.

  • Verify if the directory at 'PlaybackEngines/AndroidPlayer/NDK' exists
  • Check console logs for 'Android NDK not found or invalid' warnings
  • Compare the current install with a known working Unity version

2. Investigating the Broken Path

I compared my 2022.1.20f1 path against an older editor version where Android builds were still functioning. I noticed that while some versions include the NDK automatically, others require an explicit pointer, or the Hub fails to trigger the automated post-install script.

Attempting to copy the NDK files from another editor version led to a dead end. The build log explicitly rejected the version I ported over, citing that only specific NDK releases—like 21.3.6528147—are officially supported for this particular Unity version.

  • Cross-reference the NDK version requirements in the Unity documentation
  • Identify if the Unity Hub failed to trigger the secondary install
  • Examine Preferences > External Tools for the current path settings

3. The Independent SDK/NDK Solution

Once I realized the integrated Unity path was unreliable for this build, I opted to install the components independently. This is a more robust method that detaches your build tools from the volatile Editor directory structures.

By manually installing the NDK and SDK components via Android Studio or as standalone command-line tools, I gained full control over the file paths and ensured the versions matched the exact requirements of the engine.

  • Download the required NDK version directly from the Android developer portal
  • Install the SDK separately to ensure full platform compatibility
  • Uncheck the 'Use Embedded' option in Unity's External Tools menu

4. Final Verification and Configuration

With the tools downloaded to a stable, version-controlled location outside of the 'Program Files' mess, I pointed Unity to the new paths in Preferences > External Tools. I ensured that both the SDK and NDK paths were correctly mapped.

After restarting the Unity Hub and the Editor instance, I initiated a clean build. The compiler successfully detected the path, verified the toolchain version, and generated the APK without further complaints.

  • Point Unity Preferences to the new, custom SDK/NDK root folders
  • Clear the Library folder to force a fresh import of build settings
  • Verify build success with a simple Android development build

FAQ

Why did my clean install not include the NDK?

Sometimes the Unity Hub process fails to complete the post-installation setup for sub-components, or the specific editor version may require manual configuration depending on how the package manifest was structured.

Can I just copy the NDK from another Unity installation?

Usually no. Unity is very strict about NDK versions. If the version in the other folder doesn't match the specific build target requirements, the compiler will continue to reject it even if the path exists.