Android Studio:Build命令失败,gradle sync失败

时间:2018-05-29 13:15:17

标签: android cmake

我已经安装了android studio 3.1.2并创建了我的应用程序应用程序,但它说:

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".
它说4个错误 任何人都可以请一个解决方案

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。我希望我能在这里帮助您。 尝试创建一个新项目并更改项目位置。重要的是,新项目的位置不得包含空格。如果存在空格,则Gradle无法同步。

朱尔斯