How to build an apk?

Hey guys! Loaded a project in Android Studio, and now getting this error? How to build an apk? Before i just typed in my console cocos compile -p android, but that doesn’t work now. So i decided to install Android Studio and still not able to build an apk. Any ideas what this mistake can mean?
P.S. I am using the latest NDK.

In the Event Log, it’s quite literally pointing out the most likely cause of the problem:

“NDK version is UNKNOWN”

You haven’t stated which version of Cocos2d-x you are using, and also whether you’re using cmake or not (cocos2d-x v3.x has ndk-build and cmake, and v4 only has cmake support).

Check these areas:

and your project build.gradle:

...
android {
    compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
    ndkVersion "20.0.5594570"

    defaultConfig {
...

Make sure that NDK version matches exactly to the version you want to use.