When I build an android project which includes ndk code. I got the following error:
Build command failed.
Error while executing process /home/gongzelong/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments {-H/media/gongzelong/TOSHIBA/Code/Code/ImageLoaderEncapsulation/ImageLoader/ImageLoaderDemo/app -B/media/gongzelong/TOSHIBA/Code/Code/ImageLoaderEncapsulation/ImageLoader/ImageLoaderDemo/app/.externalNativeBuild/cmake/debug/armeabi -GAndroid Gradle - Ninja -DANDROID_ABI=armeabi -DANDROID_NDK=/home/gongzelong/Android/Sdk/ndk-bundle -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/media/gongzelong/TOSHIBA/Code/Code/ImageLoaderEncapsulation/ImageLoader/ImageLoaderDemo/app/build/intermediates/cmake/debug/obj/armeabi -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/home/gongzelong/Android/Sdk/cmake/3.6.4111459/bin/ninja -DCMAKE_TOOLCHAIN_FILE=/home/gongzelong/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-14 -DCMAKE_CXX_FLAGS=}
/media/gongzelong/TOSHIBA/Code/Code/ImageLoaderEncapsulation/ImageLoader/ImageLoaderDemo
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
Build command failed.
Error while executing process /home/gongzelong/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments {-H/media/gongzelong/TOSHIBA/Code/Code/ImageLoaderEncapsulation/ImageLoader/ImageLoaderDemo/app -B/media/gongzelong/TOSHIBA/Code/Code/ImageLoaderEncapsulation/ImageLoader/ImageLoaderDemo/app/.externalNativeBuild/cmake/release/armeabi -GAndroid Gradle - Ninja -DANDROID_ABI=armeabi -DANDROID_NDK=/home/gongzelong/Android/Sdk/ndk-bundle -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/media/gongzelong/TOSHIBA/Code/Code/ImageLoaderEncapsulation/ImageLoader/ImageLoaderDemo/app/build/intermediates/cmake/release/obj/armeabi -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=/home/gongzelong/Android/Sdk/cmake/3.6.4111459/bin/ninja -DCMAKE_TOOLCHAIN_FILE=/home/gongzelong/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-14 -DCMAKE_CXX_FLAGS=}
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
I try to locate the cause.
I found the following:
gongzelong@gongzelong:~/Android/Sdk/cmake/3.6.4111459/bin$ cmake -version
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/home/gongzelong/Android/Sdk/cmake/3.6.4111459/share/cmake-3.5
cmake version 3.5.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).
It seems that the cmake has separately versions 3.5 and 3.6.
Could anyone point out how to fix it and build the android project successfully?
Update:
I delete the cmake and install it again in android studio sdk manager.
I still got this:
null
Build command failed.
Error while executing process /home/gongzelong/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments {-H/media/gongzelong/TOSHIBA/Code/Code/ImageLoaderEncapsulation/ImageLoader/ImageLoaderDemo/app -B/media/gongzelong/TOSHIBA/Code/Code/ImageLoaderEncapsulation/ImageLoader/ImageLoaderDemo/app/.externalNativeBuild/cmake/debug/armeabi -GAndroid Gradle - Ninja -DANDROID_ABI=armeabi -DANDROID_NDK=/home/gongzelong/Android/Sdk/ndk-bundle -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/media/gongzelong/TOSHIBA/Code/Code/ImageLoaderEncapsulation/ImageLoader/ImageLoaderDemo/app/build/intermediates/cmake/debug/obj/armeabi -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/home/gongzelong/Android/Sdk/cmake/3.6.4111459/bin/ninja -DCMAKE_TOOLCHAIN_FILE=/home/gongzelong/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-14 -DCMAKE_CXX_FLAGS=}
/media/gongzelong/TOSHIBA/Code/Code/ImageLoaderEncapsulation/ImageLoader/ImageLoaderDemo
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
Build command failed.
Error while executing process /home/gongzelong/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments {-H/media/gongzelong/TOSHIBA/Code/Code/ImageLoaderEncapsulation/ImageLoader/ImageLoaderDemo/app -B/media/gongzelong/TOSHIBA/Code/Code/ImageLoaderEncapsulation/ImageLoader/ImageLoaderDemo/app/.externalNativeBuild/cmake/release/armeabi -GAndroid Gradle - Ninja -DANDROID_ABI=armeabi -DANDROID_NDK=/home/gongzelong/Android/Sdk/ndk-bundle -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/media/gongzelong/TOSHIBA/Code/Code/ImageLoaderEncapsulation/ImageLoader/ImageLoaderDemo/app/build/intermediates/cmake/release/obj/armeabi -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=/home/gongzelong/Android/Sdk/cmake/3.6.4111459/bin/ninja -DCMAKE_TOOLCHAIN_FILE=/home/gongzelong/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-14 -DCMAKE_CXX_FLAGS=}
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!