Android Studio 3.2初始构建错误(未找到testCCompiler.c文件,Windows 10)

时间:2018-12-30 15:40:55

标签: android android-studio cmake windows-10 clang

今天,我在家中的Windows 10 PC上安装了android studio 3.2.1。 (我在3个月前安装了旧版本,但在安装新版本之前已取消安装,因为我记得它存在类似的问题)

当我安装程序时,它应该可以自行构建,但是会失败,并显示以下消息。

  Run Build Command:"C:/Users/Chan  
  Kim/AppData/Local/Android/Sdk/cmake/3.6.4111459/bin/ninja.exe" "cmTC_4535f"   
  [1/2] Building C object CMakeFiles/cmTC_4535f.dir/testCCompiler.c.o   
  FAILED:   
  C:\Users\CHANKI~1\AppData\Local\Android\Sdk\NDK-BU~1\TOOLCH~1\llvm\prebuilt\WINDOW~1\bin\clang.exe    
  --target=armv7-none-linux-androideabi24 --gcc-toolchain="C:/Users/Chan    
  Kim/AppData/Local/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64"    
  --sysroot="C:/Users/Chan Kim/AppData/Local/Android/Sdk/ndk-bundle/sysroot"    
  -isystem C:/Users/Chan    
  Kim/AppData/Local/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi    
  -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong 
  -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16  
  -mthumb -mfpu=neon -Wa,--noexecstack -Wformat -Werror=format-security -fPIE   
  -o CMakeFiles/cmTC_4535f.dir/testCCompiler.c.o -c 
  C:\ANDPRG\app\.externalNativeBuild\cmake\release\armeabi-v7a\CMakeFiles\CMakeTmp\testCCompiler.c  
error: no such file or directory:   
  'Kim/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:/ANDPRG/app/.externalNativeBuild/cmake/release/armeabi-v7a/CMakeFiles/CMakeOutput.log". 
See also "C:/ANDPRG/app/.externalNativeBuild/cmake/release/armeabi-v7a/CMakeFiles/CMakeError.log".  
Build command failed.   
Error while executing process C:\Users\Chan Kim\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\ANDPRG\app -BC:\ANDPRG\app\.externalNativeBuild\cmake\debug\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-24 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\ANDPRG\app\build\intermediates\cmake\debug\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=C:\Users\Chan Kim\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_CXX_FLAGS= -DCMAKE_TOOLCHAIN_FILE=C:\Users\Chan Kim\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=C:\Users\Chan Kim\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja} 
-- Check for working C compiler: C:/Users/Chan Kim/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe   
-- Check for working C compiler: C:/Users/Chan Kim/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:/ANDPRG/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeTmp   
  Run Build Command:"C:/Users/Chan  
  Kim/AppData/Local/Android/Sdk/cmake/3.6.4111459/bin/ninja.exe" "cmTC_23398"   
  [1/2] Building C object CMakeFiles/cmTC_23398.dir/testCCompiler.c.o   
  FAILED:   
  C:\Users\CHANKI~1\AppData\Local\Android\Sdk\NDK-BU~1\TOOLCH~1\llvm\prebuilt\WINDOW~1\bin\clang.exe    
  --target=armv7-none-linux-androideabi24 --gcc-toolchain="C:/Users/Chan    
  Kim/AppData/Local/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64"    
  --sysroot="C:/Users/Chan Kim/AppData/Local/Android/Sdk/ndk-bundle/sysroot"    
  -isystem C:/Users/Chan    
  Kim/AppData/Local/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi    
  -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong 
  -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16  
  -mthumb -mfpu=neon -Wa,--noexecstack -Wformat -Werror=format-security -fPIE   
  -o CMakeFiles/cmTC_23398.dir/testCCompiler.c.o -c 
  C:\ANDPRG\app\.externalNativeBuild\cmake\debug\armeabi-v7a\CMakeFiles\CMakeTmp\testCCompiler.c    
error: no such file or directory:   
  'Kim/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:/ANDPRG/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log".   
See also "C:/ANDPRG/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeError.log".    

我在SO上看到了类似的问题,但与我的观点不完全相同,因此我尝试了建议(刷新链接的C ++项目),但没有成功。并且一些建议适用于Linux。第一个错误消息是“找不到cmake的cCompilerProgram.c”。(当我查看该文件夹时,该文件实际上不存在)如何解决此问题?顺便说一句,我在Windows 10上的登录名是'Chan Kim',中间有空格。有什么问题吗?我猜想testCCompiler.c文件是构建过程中进行构建的过程。 任何建议将不胜感激。

2 个答案:

答案 0 :(得分:0)

错误实际上显示为:

-- Check for working C compiler: .../prebuilt/windows-x86_64/bin/clang.exe -- broken

this似乎相关。

答案 1 :(得分:0)

我的问题是我在Windows10中的登录名是'Chan Kim',并且错误日志显示它无法解析包含'Chan Kim'的文件夹名称,并且无法处理该文件夹名称中的空间。因此,我创建了一个新帐户“ ckim”并进行了相同的操作(这次它在C:\ Users \ ckim下下载了大量数据),并且一切正常。
因此,请勿在使用Android Studio时将用户名与SPACE一起使用。 (我不知道为什么这本书和android studio不会对这种情况提出警告。我在书中读到,如果我的登录名包含朝鲜语字符,它将无法工作。但是事实证明带空格的登录名无效。也不能)。 希望这对某人有用。

ADD:我尝试使用Users \ ChanKim \ AppData文件夹再次配置SDK,它也可以工作。 (最初是使用Users \ Chan Kim \ AppData)