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

查看:23
本文介绍了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 是最新的,

and the sdk is good and newest,

那么 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 中仔细检查您的 ndksdk 设置,它应该类似于以下内容

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天全站免登陆