学向勤中得,萤窗万卷书。这篇文章主要讲述Android studio 3.1.3创建新项目,c ++支持同步失败相关的知识,希望能为你提供帮助。
我正在使用android studio 3.1.1创建一个支持c ++的新项目,但是我无法做任何事情并且它同步失败,消息如下:
Build command failed.Error while executing process E:AndroidSDKadt-bundle-windows-x86_64-20140702adt-bundle-windows-x86_64-20140702sdkcmake3.6.4111459incmake.exe with arguments {-HF:ASworkspaceTestJniApplicationappsrcmaincpp -BF:ASworkspaceTestJniApplicationapp.externalNativeBuildcmake
eleasearmeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-19 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=F:ASworkspaceTestJniApplicationappuildintermediatescmake
eleaseobjarmeabi-v7a -DCMAKE_BUILD_TYPE=Release -DANDROID_NDK=E:AndroidSDKadt-bundle-windows-x86_64-20140702adt-bundle-windows-x86_64-20140702sdk
dk-bundle -DCMAKE_CXX_FLAGS= -DCMAKE_TOOLCHAIN_FILE=E:AndroidSDKadt-bundle-windows-x86_64-20140702adt-bundle-windows-x86_64-20140702sdk
dk-bundleuildcmakeandroid.toolchain.cmake -DCMAKE_MAKE_PROGRAM=E:AndroidSDKadt-bundle-windows-x86_64-20140702adt-bundle-windows-x86_64-20140702sdkcmake3.6.4111459in
inja.exe -GAndroid Gradle - Ninja}-- Check for working C compiler: E:/AndroidSDK/adt-bundle-windows-x86_64-20140702/adt-bundle-windows-x86_64-20140702/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe-- Check for working C compiler: E:/AndroidSDK/adt-bundle-windows-x86_64-20140702/adt-bundle-windows-x86_64-20140702/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- broken/AndroidSDK/adt-bundle-windows-x86_64-20140702/adt-bundle-windows-x86_64-20140702/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe"is not able to compile a simple test program.
Open FileIt fails with the following output:Change Dir: F:/ASworkspace/TestJniApplication/app/.externalNativeBuild/cmake/release/armeabi-v7a/CMakeFiles/CMakeTmpRun BuildCommand:"E:AndroidSDKadt-bundle-windows-x86_64-20140702adt-bundle-windows-x86_64-20140702sdkcmake3.6.4111459in
inja.exe""cmTC_bc909"[1/2] Building C object CMakeFiles/cmTC_bc909.dir/testCCompiler.c.o[2/2] Linking C executable cmTC_bc909FAILED: cmd.exe /C "cd .&
&
E:AndroidSDKadt-bundle-windows-x86_64-20140702adt-bundle-windows-x86_64-20140702sdk
dk-bundle oolchainsllvmprebuiltwindows-x86_64inclang.exe--target=armv7-none-linux-androideabi--gcc-toolchain=E:/AndroidSDK/adt-bundle-windows-x86_64-20140702/adt-bundle-windows-x86_64-20140702/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64--sysroot=E:/AndroidSDK/adt-bundle-windows-x86_64-20140702/adt-bundle-windows-x86_64-20140702/sdk/ndk-bundle/sysroot-isystemE:/AndroidSDK/adt-bundle-windows-x86_64-20140702/adt-bundle-windows-x86_64-20140702/sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi-D__ANDROID_API__=19 -g -DANDROID -ffunction-sections -funwind-tables-fstack-protector-strong -no-canonical-pre-- Configuring incomplete,fixes -march=armv7-a
errors occurred!-mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Wa,--noexecstack -Wformat
文章图片
并且sdk是好的和最新的,
文章图片
然后gradle vers ion是3.1.3.i对此没有任何想法,任何人都可以帮助我吗?谢谢。
答案
adt-bundle-windows-x86_64-20140702
对Android Studio来说太旧了。不确定为什么你的项目仍在使用这个旧的工具链。只需删除此ADT捆绑包(它在2014年发布,实在太旧而无法与您的Android Studio 3.1.3兼容)。只需下载最新的Android Studio并使用内置的SDK和NDK捆绑即可。
【Android studio 3.1.3创建新项目,c ++支持同步失败】您可以从项目根目录下的
local.properties
中仔细检查您的ndk和sdk设置,它应该如下所示ndk.dir=<
your-ndk-root-dir>
sdk.dir=<
your-sdk-root-dir>
推荐阅读
- 构建使用协议缓冲区的Android可执行gRPC服务器(不使用APK)
- 在没有Android Studio的情况下为Android创建(Cmake)C / C ++库
- Android NDK“ndk-build”被识别为内部或外部命令批处理文件
- 将cpp类添加到android项目中
- 如何使用Android.mk为不同的平台指定不同的CFLAGS
- 如何在Android上进行SSL对等验证工作()
- 在android NDK中包含本地头文件时的未定义引用
- 平台android NDK不支持ABIs [armeabi,mips]
- 如何在MonoTouch中为继承的视图创建UIAppearance代理()