Error: executing external native build for cmake C:\\Users\\PC1\\Desktop\\ndkdata\\GDNdkText\\app\\CMakeLists.txt
I have installed NDK, CMake, LLDP as mentioned here . Do I need to install any other tool or need to set any environment variables?
If you run under Linux you need to install Ninja. sudo apt install ninja-build
Tested today.
你必须使用自制软件安装忍者
brew install ninja
您还需要安装ncurses5
(对于 arch-linux,其 AUR 包 - ncurses5-compat-libs
),因为 Android Studio 2.2 上的 NDK 支持不使用可能已安装在您的系统上的 ncurses6。
我通过检查日志文件解决了我的问题。
./app/.cxx/cmake/commonDebug/x86/android_gradle_generate_cmake_ninja_json_x86.stderr.txt
I think the problem is the wrong location of CMakelist.txt file.
Try to move CMakelist.txt file from your app root directory to app/src/main/cpp/CMakelist.txt directory and then update the location from gradle file also like this:
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
}
}
如果你想让你的项目不包含任何 C++ 文件,请确保你没有选中在新项目开始时包含 C++ 的框
I ran into this issue when importing a co-workers workspace. We were getting external native build errors. And it seemed like the IDE was ignoring a lot of the CMake commands.
It turns out the issue was that I didn't have Ninja installed as suggest in ariel's post above. I discovered this by running gradlew build --stacktrace
and found a line complaining about not having Ninja installed. Note: we are developing in a linux environment.
Ninja is a build system that focuses on speed, and is used to replace make
in systems with a large number of input files. Ninja Wiki
Once I installed ninja, everything build perfectly!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.