构建命令失败,外部原生问题android studio

时间:2018-07-18 04:38:12

标签: java android c++ android-studio android-studio-3.1.3

我不理解android studio有什么问题,我是android的新应用程序,所以我真的不明白错误在哪里以及如何解决(如果您需要其他东西,请问我和我要放了)

这是我的错误:

null 
Build command failed. 
Error while executing process C:\Users\Raul del Rio\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Users\Raul del Rio\AndroidStudioProjects\MyApplication2\app -BC:\Users\Raul del Rio\AndroidStudioProjects\MyApplication2\app\.externalNativeBuild\cmake\release\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-15 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Raul del Rio\AndroidStudioProjects\MyApplication2\app\build\intermediates\cmake\release\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DANDROID_NDK=C:\Users\Raul del Rio\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_CXX_FLAGS= -DCMAKE_TOOLCHAIN_FILE=C:\Users\Raul del Rio\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=C:\Users\Raul del Rio\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja} 
-- Check for working C compiler: C:/Users/Raul del Rio/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe 
-- Check for working C compiler: C:/Users/Raul del Rio/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- broken 
C:/Users/Raul del Rio/AndroidStudioProjects/MyApplication2 
  It fails with the following output: 
   Change Dir: C:/Users/Raul del Rio/AndroidStudioProjects/MyApplication2/app/.externalNativeBuild/cmake/release/armeabi-v7a/CMakeFiles/CMakeTmp 
  Run Build Command:"C:/Users/Raul del 
  Rio/AppData/Local/Android/Sdk/cmake/3.6.4111459/bin/ninja.exe" "cmTC_48907" 
  [1/2] Building C object CMakeFiles/cmTC_48907.dir/testCCompiler.c.o 
  FAILED: 
  C:\Users\RAULDE~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/Raul del 
  Rio/AppData/Local/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64" 
  --sysroot="C:/Users/Raul del 
  Rio/AppData/Local/Android/Sdk/ndk-bundle/sysroot" -isystem C:/Users/Raul 
  del 
  Rio/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_48907.dir/testCCompiler.c.o -c 
  "C:\Users\Raul del 
  Rio\AndroidStudioProjects\MyApplication2\app\.externalNativeBuild\cmake\release\armeabi-v7a\CMakeFiles\CMakeTmp\testCCompiler.c" 
error: no such file or directory: 'del'

error: no such file or directory: 
  'Rio/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/Raul del Rio/AndroidStudioProjects/MyApplication2/app/.externalNativeBuild/cmake/release/armeabi-v7a/CMakeFiles/CMakeOutput.log". 
See also "C:/Users/Raul del Rio/AndroidStudioProjects/MyApplication2/app/.externalNativeBuild/cmake/release/armeabi-v7a/CMakeFiles/CMakeError.log". 
Build command failed. 
Error while executing process C:\Users\Raul del Rio\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Users\Raul del Rio\AndroidStudioProjects\MyApplication2\app -BC:\Users\Raul del Rio\AndroidStudioProjects\MyApplication2\app\.externalNativeBuild\cmake\debug\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-15 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Raul del Rio\AndroidStudioProjects\MyApplication2\app\build\intermediates\cmake\debug\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=C:\Users\Raul del Rio\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_CXX_FLAGS= -DCMAKE_TOOLCHAIN_FILE=C:\Users\Raul del Rio\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=C:\Users\Raul del Rio\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja} 
-- Check for working C compiler: C:/Users/Raul del Rio/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe 
-- Check for working C compiler: C:/Users/Raul del Rio/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- broken 
  It fails with the following output: 
   Change Dir: C:/Users/Raul del Rio/AndroidStudioProjects/MyApplication2/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeTmp 
  Run Build Command:"C:/Users/Raul del 
  Rio/AppData/Local/Android/Sdk/cmake/3.6.4111459/bin/ninja.exe" "cmTC_405c9" 
  [1/2] Building C object CMakeFiles/cmTC_405c9.dir/testCCompiler.c.o 
  FAILED: 
  C:\Users\RAULDE~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/Raul del 
  Rio/AppData/Local/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64" 
  --sysroot="C:/Users/Raul del 
  Rio/AppData/Local/Android/Sdk/ndk-bundle/sysroot" -isystem C:/Users/Raul 
  del 
  Rio/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_405c9.dir/testCCompiler.c.o -c 
  "C:\Users\Raul del 
  Rio\AndroidStudioProjects\MyApplication2\app\.externalNativeBuild\cmake\debug\armeabi-v7a\CMakeFiles\CMakeTmp\testCCompiler.c" 
error: no such file or directory: 'del'

error: no such file or directory: 
  'Rio/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/Raul del Rio/AndroidStudioProjects/MyApplication2/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Raul del Rio/AndroidStudioProjects/MyApplication2/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeError.log".   

当我尝试编译以开始编程时,这就是我得到的。

1 个答案:

答案 0 :(得分:1)

尝试添加:

externalNativeBuild {
    cmake {
        arguments '-DBUILD_TESTING=OFF', '-DANDROID_TOOLCHAIN=gcc-4.9'
        cppFlags "-std=c++14 -fexceptions -frtti"
    }
}

在您的defaultConfig中的build.gradle中。这应该使Android Studio使用默认的gcc工具链。