用AS导入项目BUILD报错

怎么解决这个问题
把图中这一行注释掉BUILD就过了,
但是我还什么代码都没写刚COCOS new了一个空项目,

过了,只是过了而已,项目可能都没编译,报错具体信息要点开右下角 Gradle Console 看

。。。。。。。。。。
Configuration on demand is an incubating feature.
NDK is missing a “platforms” directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\Users\Administrator\AppData\Local\Android\Sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

NDK is missing a “platforms” directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\Users\Administrator\AppData\Local\Android\Sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

Incremental java compilation is an incubating feature.

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ‘:MyGame’.

java.lang.NullPointerException (no error message)

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

提示说的很明白,你设置了 ANDROID_NDK_HOME 这个环境变量,但是环境变量对应的目录找不到ndk,确定一下ndk的版本,下载ndk,配置环境变量

我也遇到了,先分析下报错信息,问题是出在Ndk无法编译,可能导致的原因是:
1.ndk版本不对
2.ndk设置的路径不对:
目前最新ndk是没有ndk-bundle文件夹了,直接配置的时候设置ndk版本路径:D:\AndoridStudio\sdk\ndk\21.3.6528147
3.ndk没有设置环境变量:
这个可以网上搜,设置成功的标志是,cmd终端运行:ndk-build有反应