"NDK not configured. Download it with SDK manager" on Compilation

No matter what I do, I’m getting this error, from Cocos Creator Version 1.5 and now, 1.5.1-beta.4.2

FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':MyGame'.
> NDK not configured. 
  Download it with SDK manager.)

This is strange because things were working perfectly fine on Cocos Creator 1.4.

These environment variables are enabled:

ANDROID_NDK_HOME=/Users/Justin/Desktop/tools/android-ndk-r10e
ANDROID_NDK=/Users/Justin/Desktop/tools/android-ndk-r10e
NDK_ROOT=/Users/Justin/Desktop/tools/android-ndk-r10e

Why might they be getting skipped?

I also filled out the Preferences -> Native Develop field with the same exact path.
I even downloaded a separate NDK through Android Studio interface for the CocosCreator-generated project file, and set the path there. It gets wiped out for every build.

If you try to manually set the ndk.dir in the local.properties file in the same way that sdk.dir is defined, it also gets wiped out on every build.

I get same error. I fix it by update SDK with SDK manager.

U can set in Android-studio path for ndk in project settings. File->project structure

Updating the SDK worked. Strange.

Build from CCreator then Open android studio project from build directory. Set NDK path from project structure in android studio and run ! That how i solved my problem. But still i cant compile apk from CCreator.

Yes, update SDK Tools to the latest version works for me too.

In case someone what some visual guide to fix this error. I use

  • Win 7 Ultimate 64 bit
  • Cocos Creator 1.5.2
  • Android Studio 2.3.3
  • Android NDK r15c (latest version as of writing) standalone version (I didn’t download it from SDK Manager)

Steps

  1. Open Android Studio
  2. From menu, Tools → Android → SDK Manager
  3. In the right side, choose SDK Tools tab
  4. Scroll down until you see Android SDK Tools, there should be “Update Available” message in status column.
  5. Tick the checkbox → Click Apply

  1. Now error “NDK not configured” shouldn’t occur when you click “Compile” button in Project → Build…