Когда я открываю новый проект, поддерживающий C ++ в Android Studio, выводится только «Hello C ++», и я не модифицировал ни один код.Я попытался изменить версию Android Studio и SDK.Но это всегда показывает одну и ту же ошибку.
Моя платформа разработки: Windows 10
Текущая версия: Android Studio 3.1.2
Большое спасибо
Ошибка при сборке:
Build command failed.
Error while executing process C:\Users\15829\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Users\15829\AndroidStudioProjects\MyApplication\app -BC:\Users\15829\AndroidStudioProjects\MyApplication\app\.externalNativeBuild\cmake\debug\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-15 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\15829\AndroidStudioProjects\MyApplication\app\build\intermediates\cmake\debug\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=C:\Users\15829\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_CXX_FLAGS= -DCMAKE_TOOLCHAIN_FILE=C:\Users\15829\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=C:\Users\15829\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja}
-- Check for working C compiler: C:/Users/15829/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
-- Check for working C compiler: C:/Users/15829/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- broken
/Users/15829/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/15829/AndroidStudioProjects/MyApplication/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeTmp
Run Build
Command:"C:\Users\15829\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe"
"cmTC_a2146"
[1/2] Building C object CMakeFiles/cmTC_a2146.dir/testCCompiler.c.o
[2/2] Linking C executable cmTC_a2146
FAILED: cmd.exe /C "cd . &&
C:\Users\15829\AppData\Local\Android\Sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe
--target=armv7-none-linux-androideabi
--gcc-toolchain=C:/Users/15829/AppData/Local/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64
--sysroot=C:/Users/15829/AppData/Local/Android/Sdk/ndk-bundle/sysroot
-isystem
C:/Users/15829/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 -Wl,--exclude-libs,libgcc.a
-Wl,--exclude-libs,libatomic.a -nostdlib++ --sysroot
C:/Users/15829/AppData/Local/Android/Sdk/ndk-bundle/platforms/android-15/arch-arm
-Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings
-Wl,--fix-cortex-a8 -Wl,--exclude-libs,libunwind.a
-LC:/Users/15829/AppData/Local/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a
-Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro
-Wl,-z,now -Wl,--gc-sections -Wl,-z,nocopyreloc
CMakeFiles/cmTC_a2146.dir/testCCompiler.c.o -o cmTC_a2146 -latomic -lm &&
cd ."
error: no such file or directory:
'CMakeFiles/cmTC_a2146.dir/testCCompiler.c.o'
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/15829/AndroidStudioProjects/MyApplication/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log".
See also "C:/Users/15829/AndroidStudioProjects/MyApplication/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeError.log".
Build command failed.
Error while executing process C:\Users\15829\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Users\15829\AndroidStudioProjects\MyApplication\app -BC:\Users\15829\AndroidStudioProjects\MyApplication\app\.externalNativeBuild\cmake\release\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-15 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\15829\AndroidStudioProjects\MyApplication\app\build\intermediates\cmake\release\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DANDROID_NDK=C:\Users\15829\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_CXX_FLAGS= -DCMAKE_TOOLCHAIN_FILE=C:\Users\15829\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=C:\Users\15829\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja}
-- Check for working C compiler: C:/Users/15829/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
-- Check for working C compiler: C:/Users/15829/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- broken
/Users/15829/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/15829/AndroidStudioProjects/MyApplication/app/.externalNativeBuild/cmake/release/armeabi-v7a/CMakeFiles/CMakeTmp
Run Build
Command:"C:\Users\15829\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe"
"cmTC_e2e33"
[1/2] Building C object CMakeFiles/cmTC_e2e33.dir/testCCompiler.c.o
[2/2] Linking C executable cmTC_e2e33
FAILED: cmd.exe /C "cd . &&
C:\Users\15829\AppData\Local\Android\Sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe
--target=armv7-none-linux-androideabi
--gcc-toolchain=C:/Users/15829/AppData/Local/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64
--sysroot=C:/Users/15829/AppData/Local/Android/Sdk/ndk-bundle/sysroot
-isystem
C:/Users/15829/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 -Wl,--exclude-libs,libgcc.a
-Wl,--exclude-libs,libatomic.a -nostdlib++ --sysroot
C:/Users/15829/AppData/Local/Android/Sdk/ndk-bundle/platforms/android-15/arch-arm
-Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings
-Wl,--fix-cortex-a8 -Wl,--exclude-libs,libunwind.a
-LC:/Users/15829/AppData/Local/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a
-Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro
-Wl,-z,now -Wl,--gc-sections -Wl,-z,nocopyreloc
CMakeFiles/cmTC_e2e33.dir/testCCompiler.c.o -o cmTC_e2e33 -latomic -lm &&
cd ."
error: no such file or directory:
'CMakeFiles/cmTC_e2e33.dir/testCCompiler.c.o'
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/15829/AndroidStudioProjects/MyApplication/app/.externalNativeBuild/cmake/release/armeabi-v7a/CMakeFiles/CMakeOutput.log".
See also "C:/Users/15829/AndroidStudioProjects/MyApplication/app/.externalNativeBuild/cmake/release/armeabi-v7a/CMakeFiles/CMakeError.log".