Android Studio 3.1.3使用C ++支持同步创建新项目失败 [英] Android studio 3.1.3 create new project with c++ support sync failed

查看:105
本文介绍了Android Studio 3.1.3使用C ++支持同步创建新项目失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Android Studio 3.1.1创建一个具有c ++支持的新项目,但我却无能为力,并且同步失败,消息如下:

I am using Android studio 3.1.1 to create a new project with c++ support, but i could not do anything and it sync failed,the message is below:

Build command failed.

Error while executing process E:\AndroidSDK\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HF:\ASworkspace\TestJniApplication\app\src\main\cpp -BF:\ASworkspace\TestJniApplication\app\.externalNativeBuild\cmake\release\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-19 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=F:\ASworkspace\TestJniApplication\app\build\intermediates\cmake\release\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DANDROID_NDK=E:\AndroidSDK\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\ndk-bundle -DCMAKE_CXX_FLAGS= -DCMAKE_TOOLCHAIN_FILE=E:\AndroidSDK\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=E:\AndroidSDK\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\cmake\3.6.4111459\bin\ninja.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 File

  It fails with the following output:

   Change Dir: F:/ASworkspace/TestJniApplication/app/.externalNativeBuild/cmake/release/armeabi-v7a/CMakeFiles/CMakeTmp

  Run Build

  Command:"E:\AndroidSDK\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\cmake\3.6.4111459\bin\ninja.exe"

  "cmTC_bc909"

  [1/2] Building C object CMakeFiles/cmTC_bc909.dir/testCCompiler.c.o

  [2/2] Linking C executable cmTC_bc909

  FAILED: cmd.exe /C "cd .  &&

  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

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

  -isystem

  E:/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版本是3.1.3.我对此一无所知,有人可以帮我吗? 谢谢.

then the gradle vers ion is 3.1.3.i have no idea about this,could anyone help me? Thank you.

推荐答案

adt-bundle-windows-x86_64-20140702对于Android Studio而言太旧了.不确定为什么您的项目仍在使用此旧工具链.

adt-bundle-windows-x86_64-20140702 is too old for Android Studio. Not sure why your project is still using this old tool chains.

只需删除此ADT捆绑包(该捆绑包于2014年发布,但由于过旧而无法与您的Android Studio 3.1.3兼容).只需下载最新的Android Studio并使用内置的SDK和NDK捆绑包即可正常工作.

Just delete this ADT bundle (it was release in 2014 and really too old to be compatible with your Android Studio 3.1.3). Just download the latest Android Studio and use the built-in SDK and NDK bundle will work well.

您可以在项目根目录下的local.properties中再次检查 ndk sdk 设置,该设置应类似于

You can double check your ndk and sdk settings from your local.properties under your project root and it should be something like below

ndk.dir=<your-ndk-root-dir>
sdk.dir=<your-sdk-root-dir> 

这篇关于Android Studio 3.1.3使用C ++支持同步创建新项目失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆