Q: Android Studio: Build Command failed gradle sync failed I have installed android studio 3.1.2 and creates My application app but it says this:
Build command failed.
Error while executing process C:\Users\Rajeev Sarraf\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Users\Rajeev Sarraf\ApkProjects\MyApplication\app -BC:\Users\Rajeev Sarraf\ApkProjects\MyApplication\app\.externalNativeBuild\cmake\release\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-15 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Rajeev Sarraf\ApkProjects\MyApplication\app\build\intermediates\cmake\release\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DANDROID_NDK=C:\Users\Rajeev Sarraf\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_CXX_FLAGS= -DCMAKE_TOOLCHAIN_FILE=C:\Users\Rajeev Sarraf\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=C:\Users\Rajeev Sarraf\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja}


-- Check for working C compiler: C:/Users/Rajeev Sarraf/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe


-- Check for working C compiler: C:/Users/Rajeev Sarraf/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- broken


/Users/Rajeev   Sarraf/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe"   is not able to compile a simple test program. 
Open File


  It fails with the following output:


   Change Dir: C:/Users/Rajeev Sarraf/ApkProjects/MyApplication/app/.externalNativeBuild/cmake/release/armeabi-v7a/CMakeFiles/CMakeTmp


  Run Build Command:"C:/Users/Rajeev


  Sarraf/AppData/Local/Android/Sdk/cmake/3.6.4111459/bin/ninja.exe"


  "cmTC_c2a5a"


  [1/2] Building C object CMakeFiles/cmTC_c2a5a.dir/testCCompiler.c.o


  FAILED:


  C:\Users\RAJEEV~1\AppData\Local\Android\Sdk\NDK-BU~1\TOOLCH~1\llvm\prebuilt\WINDOW~1\bin\clang.exe


  --target=armv7-none-linux-androideabi --gcc-toolchain="C:/Users/Rajeev


  Sarraf/AppData/Local/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64"


  --sysroot="C:/Users/Rajeev


  Sarraf/AppData/Local/Android/Sdk/ndk-bundle/sysroot" -isystem


  C:/Users/Rajeev


  Sarraf/AppData/Local/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi


  -D__ANDROID_API__=15 -g -DANDROID -ffunction-sections -funwind-tables


  -fstack-protector-strong -no-canonical-prefixes -march=armv7-a


  -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Wa,--noexecstack -Wformat


  -Werror=format-security -o CMakeFiles/cmTC_c2a5a.dir/testCCompiler.c.o -c


  "C:\Users\Rajeev


  Sarraf\ApkProjects\MyApplication\app\.externalNativeBuild\cmake\release\armeabi-v7a\CMakeFiles\CMakeTmp\testCCompiler.c"


error: no such file or directory:


  'Sarraf/AppData/Local/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi'



  ninja: build stopped: subcommand failed.


  CMake will not be able to correctly generate this project.


Call Stack (most recent call first):


  CMakeLists.txt


-- Configuring incomplete, errors occurred!


See also "C:/Users/Rajeev Sarraf/ApkProjects/MyApplication/app/.externalNativeBuild/cmake/release/armeabi-v7a/CMakeFiles/CMakeOutput.log".


See also "C:/Users/Rajeev Sarraf/ApkProjects/MyApplication/app/.externalNativeBuild/cmake/release/armeabi-v7a/CMakeFiles/CMakeError.log".


Build command failed.


Error while executing process C:\Users\Rajeev Sarraf\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Users\Rajeev Sarraf\ApkProjects\MyApplication\app -BC:\Users\Rajeev Sarraf\ApkProjects\MyApplication\app\.externalNativeBuild\cmake\debug\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-15 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Rajeev Sarraf\ApkProjects\MyApplication\app\build\intermediates\cmake\debug\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=C:\Users\Rajeev Sarraf\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_CXX_FLAGS= -DCMAKE_TOOLCHAIN_FILE=C:\Users\Rajeev Sarraf\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=C:\Users\Rajeev Sarraf\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja}


-- Check for working C compiler: C:/Users/Rajeev Sarraf/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe


-- Check for working C compiler: C:/Users/Rajeev Sarraf/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- broken


/Users/Rajeev   Sarraf/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe"   is not able to compile a simple test program. 
Open File


  It fails with the following output:


   Change Dir: C:/Users/Rajeev Sarraf/ApkProjects/MyApplication/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeTmp


  Run Build Command:"C:/Users/Rajeev


  Sarraf/AppData/Local/Android/Sdk/cmake/3.6.4111459/bin/ninja.exe"


  "cmTC_f8247"


  [1/2] Building C object CMakeFiles/cmTC_f8247.dir/testCCompiler.c.o


  FAILED:


  C:\Users\RAJEEV~1\AppData\Local\Android\Sdk\NDK-BU~1\TOOLCH~1\llvm\prebuilt\WINDOW~1\bin\clang.exe


  --target=armv7-none-linux-androideabi --gcc-toolchain="C:/Users/Rajeev


  Sarraf/AppData/Local/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64"


  --sysroot="C:/Users/Rajeev


  Sarraf/AppData/Local/Android/Sdk/ndk-bundle/sysroot" -isystem


  C:/Users/Rajeev


  Sarraf/AppData/Local/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi


  -D__ANDROID_API__=15 -g -DANDROID -ffunction-sections -funwind-tables


  -fstack-protector-strong -no-canonical-prefixes -march=armv7-a


  -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Wa,--noexecstack -Wformat


  -Werror=format-security -o CMakeFiles/cmTC_f8247.dir/testCCompiler.c.o -c


  "C:\Users\Rajeev


  Sarraf\ApkProjects\MyApplication\app\.externalNativeBuild\cmake\debug\armeabi-v7a\CMakeFiles\CMakeTmp\testCCompiler.c"


error: no such file or directory:


  'Sarraf/AppData/Local/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi'



  ninja: build stopped: subcommand failed.


  CMake will not be able to correctly generate this project.


Call Stack (most recent call first):


  CMakeLists.txt


-- Configuring incomplete, errors occurred!


See also "C:/Users/Rajeev Sarraf/ApkProjects/MyApplication/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log".


See also "C:/Users/Rajeev Sarraf/ApkProjects/MyApplication/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeError.log".

it says 4 errors
anyone can please give a solution

A: I had the same Problem. I hope i can help u here. 
Try to create a new project and change the project location. Its important, that the new project location, contain NO whitespace. Gradle cannot sync, if there is whitespace.
Jules
