1

today I installed android studio 3.2.1 on my windows 10 PC at home. (I have installed a previous version 3 months ago but I unstalled it before installing new one, because it had similar problem I remember)

When I install the program, it is supposed to build itself but it fails with below messages.

  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".    

I saw similar question on SO but it's not exactly same to my situtation and I tried the suggestions(Refresh linked C++ project) and it didn't work. and some advices are for linux. The first error message is 'can't find cCompilerProgram.c' for cmake.(When I look into the folder, the file is not actuall there) How can I solve this? By the way, my login name on windows 10 is 'Chan Kim' with space in the middle. Can it have any problem? I guess the testCCompiler.c file is what the build process make during the build. Any suggestion will be deeply appreciated.

Chan Kim
  • 5,177
  • 12
  • 57
  • 112

2 Answers2

0

the error actually reads:

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

this seems related.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
  • it's the summary. actual problem is shown before 'file testCcompiler.c not found'. During the build, it usually make a very simple C program and try to compile it, and for some reason that test .C program file was not generated. Don't you agree? (I actually have the clang.exe file in the folder) – Chan Kim Dec 30 '18 at 15:49
  • @ChanKim with a broken tool-chain, it should be obvious why nothing was compiled... the rest of the output are only follow-up errors, based upon the fact that the tool-chain is broken. – Martin Zeitler Dec 30 '18 at 15:53
  • My question is, why is it broken? when I installed android studio from the web. My guess is that my login name is 'Chan Kim' and the program is accessing Chan. I tried it in the terminal and it seems stuck at 'Chan'. when it should search down 'Chan Kim\...' – Chan Kim Dec 30 '18 at 15:55
  • maybe I will make a new account and try again later. – Chan Kim Dec 30 '18 at 15:56
  • Yes, I made a new account 'ckim' and there is no problem in building a simple app in the book. – Chan Kim Dec 30 '18 at 16:45
0

My problem was that my login name in windows10 was 'Chan Kim' and the error log shows it cannot parse down the folder name containing 'Chan Kim' and it cannot process space in the folder name. So I created a new account 'ckim' and did the same (it downloads huge amount of data under C:\Users\ckim this time) and everything works fine.
So DON'T USE USERNAME WITH SPACE whne using android studio. (I don't know why the book and android studio doesn't warn about this situtation. I read in the book, if my login name contains Korean characters, it won't work. but it turns out login name with space doesn't work either). Hope this be useful for someone.

ADD : I tried configuring the SDK again using Users\ChanKim\AppData folder and it works too. (originally it was using Users\Chan Kim\AppData)

Chan Kim
  • 5,177
  • 12
  • 57
  • 112