无法在android studio中找到CMake

ashish mishra 12/19/2016. 3 answers, 4.906 views
android android android-studio android-studio android-ndk android-ndk cmake

我需要在我的android程序中添加C / C ++代码,为此我需要LLDB,CMake和NDK。 我在SDK管理器中发现了LLDB和NDK,但是CMake从那里不见了。 我尝试从CMake官方网站手动下载它,发现对于android我们需要SDK定制的CMake。

在这里输入图像描述

正如你所看到的,没有像CMake这样的选项。

任何人都可以帮助找到版本的CMake为Android? 提前致谢。

UPDATE

编辑:我已经尝试过CMake从网站和我发现ndk-bundle / build文件夹,但都给出了如下相同的错误。 请看一下,让我们知道您是否可以从中解决问题并帮助解决问题。 谢谢。

Build command failed.

Error while executing 'C:\Users\amishr33\AppData\Local\Android\sdk\cmake\bin\cmake.exe' with arguments {-HC:\Users\amishr33\AndroidStudioProjects\MyApplication\app\src\main\jni -BC:\Users\amishr33\AndroidStudioProjects\MyApplication\app\.externalNativeBuild\cmake\debug\armeabi -GAndroid Gradle - Ninja -DANDROID_ABI=armeabi -DANDROID_NDK=C:\Users\amishr33\AppData\Local\Android\sdk\ndk-bundle -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\amishr33\AndroidStudioProjects\MyApplication\app\build\intermediates\cmake\debug\obj\armeabi -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=C:\Users\amishr33\AppData\Local\Android\sdk\cmake\bin\ninja.exe -DCMAKE_TOOLCHAIN_FILE=C:\Users\amishr33\AppData\Local\Android\sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=15 -DCMAKE_CXX_FLAGS=-std=c++11 -DANDROID_TOOLCHAIN=clang -DANDROID_STL=gnustl_static}
CMake Error: Could not create named generator Android Gradle - Ninja
Generators
  Visual Studio 15 2017 [arch] = Generates Visual Studio 2017 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Visual Studio 9 2008 [arch]  = Generates Visual Studio 2008 project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Visual Studio 8 2005 [arch]  = Generates Visual Studio 2005 project files.
                                 Optional [arch] can be "Win64".
  Visual Studio 7 .NET 2003    = Deprecated.  Generates Visual Studio .NET
                                 2003 project files.
  Borland Makefiles            = Generates Borland makefiles.
  NMake Makefiles              = Generates NMake makefiles.
  NMake Makefiles JOM          = Generates JOM makefiles.
  Green Hills MULTI            = Generates Green Hills MULTI files
                                 (experimental, work-in-progress).
  MSYS Makefiles               = Generates MSYS makefiles.
  MinGW Makefiles              = Generates a make file for use with
                                 mingw32-make.
  Unix Makefiles               = Generates standard UNIX makefiles.
  Ninja                        = Generates build.ninja files.
  Watcom WMake                 = Generates Watcom WMake makefiles.
  CodeBlocks - MinGW Makefiles = Generates CodeBlocks project files.
  CodeBlocks - NMake Makefiles = Generates CodeBlocks project files.
  CodeBlocks - Ninja           = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
  CodeLite - MinGW Makefiles   = Generates CodeLite project files.
  CodeLite - NMake Makefiles   = Generates CodeLite project files.
  CodeLite - Ninja             = Generates CodeLite project files.
  CodeLite - Unix Makefiles    = Generates CodeLite project files.
  Sublime Text 2 - MinGW Makefiles
                               = Generates Sublime Text 2 project files.
  Sublime Text 2 - NMake Makefiles
                               = Generates Sublime Text 2 project files.
  Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles
                               = Generates Sublime Text 2 project files.
  Kate - MinGW Makefiles       = Generates Kate project files.
  Kate - NMake Makefiles       = Generates Kate project files.
  Kate - Ninja                 = Generates Kate project files.
  Kate - Unix Makefiles        = Generates Kate project files.
  Eclipse CDT4 - NMake Makefiles
                               = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - MinGW Makefiles
                               = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
Error:executing external native build for cmake C:\Users\amishr33\AndroidStudioProjects\MyApplication\app\src\main\jni\CMakeLists.txt 
2 Comments
Alberto López Pérez 12/23/2016
你正在使用哪个版本的Android工作室? 尝试update to the lastest ,我试图更新我的android Studio到2.2.3,并在Android SDK - > SDK工具它看起来像我可以在这里看到: 截图我希望我帮助你m8:D抱歉回答位晚:(
Jon Goodwin 01/11/2017
你使用32位窗口吗? Android Studio Cmake仅适用于64位机器。 这就是为什么你无法在SDK管理器中找到Cmake的原因。

3 Answers


user2477865 04/04/2017.
  1. 检入您的应用程序模块的build.gradle文件

    externalNativeBuild {cmake {path“CMakeLists.txt”}}

  2. 删除cmake部分

  3. 重新同步项目:
    进入菜单Build - > Refersh Lined C ++ Projects

  4. 右键单击该模块,例如应用程序模块,从菜单中选择“使用Gradle链接C ++项目”。

  5. 您应该看到类似于下图所示的对话框。

    在这里输入图像描述

  6. 点击确定。


检查这个,我认为这个网站解释你需要什么:

https://codelabs.developers.google.com/codelabs/android-studio-cmake/index.html?index=..%2F..%2Findex#0

请记住检查“您需要什么”

更新:

NDK: https//developer.android.com/ndk/downloads/index.html来源: https//developer.android.com/ndk/index.html

CMake: https ://cmake.org/files/v3.7/cmake-3.7.1-win64-x64.zip来源: https//cmake.org/

LLDB(仅适用于debain系统): http ://apt.llvm.org/ source: http ://lldb.llvm.org/download.html

一旦你下载这些文件,复制到你的sdk文件夹(通常在:“C:\ android-sdk \”)你可以在这里本地化文件夹:

  1. 文件 - >项目结构到项目结构
  2. 左 - > SDK位置

然后你可以在下载后继续使用前面的指南:)

5 comments
ashish mishra 12/19/2016
但它并没有告诉如何/在哪里获得CMake的android工作室。
Alberto López Pérez 12/19/2016
您正在搜索“下载”部分?
Alberto López Pérez 12/19/2016
检查此链接: developer.android.com/studio/projects/add-native-code.html如果您有任何问题,请告诉我,我很乐意帮助您:D
ashish mishra 12/20/2016
下载部分要求打开SDK管理器并从他们的下载CMake ...但SDK管理器中没有CMake选项。
2 ashish mishra 12/22/2016
我已经尝试过这部分,从它的网站手动下载cmake并将其保存在sdk文件夹中。 但它不起作用。 在我对这个问题的研究中,我发现SDK使用了一个专门为Android定制的CMake,我试图找到该版本的CMake。

Sylwester Muzyka 01/17/2017.

重新安装Android Studio应该有所帮助。 我有同样的问题,并重新安装帮助我。


HighResolutionMusic.com - Download Hi-Res Songs

1 (G)I-DLE

POP/STARS flac

(G)I-DLE. 2018. Writer: Riot Music Team;Harloe.
2 Ariana Grande

​Thank U, Next flac

Ariana Grande. 2018. Writer: Crazy Mike;Scootie;Victoria Monét;Tayla Parx;TBHits;Ariana Grande.
3 Clean Bandit

Baby flac

Clean Bandit. 2018. Writer: Jack Patterson;Kamille;Jason Evigan;Matthew Knott;Marina;Luis Fonsi.
4 Imagine Dragons

Bad Liar flac

Imagine Dragons. 2018. Writer: Jorgen Odegard;Daniel Platzman;Ben McKee;Wayne Sermon;Aja Volkman;Dan Reynolds.
5 Halsey

Without Me flac

Halsey. 2018. Writer: Halsey;Delacey;Louis Bell;Amy Allen;Justin Timberlake;Timbaland;Scott Storch.
6 BTS

Waste It On Me flac

BTS. 2018. Writer: Steve Aoki;Jeff Halavacs;Ryan Ogren;Michael Gazzo;Nate Cyphert;Sean Foreman;RM.
7 Nicki Minaj

No Candle No Light flac

Nicki Minaj. 2018. Writer: Denisia “Blu June” Andrews;Kathryn Ostenberg;Brittany "Chi" Coney;Brian Lee;TJ Routon;Tushar Apte;ZAYN;Nicki Minaj.
8 Backstreet Boys

Chances flac

Backstreet Boys. 2018.
9 BlackPink

Kiss And Make Up flac

BlackPink. 2018. Writer: Soke;Kny Factory;Billboard;Chelcee Grimes;Teddy Park;Marc Vincent;Dua Lipa.
10 Little Mix

The Cure flac

Little Mix. 2018. Writer: Pete Kelleher;Camille Purcell;Tom Barnes;Ben Kohn.
11 Fitz And The Tantrums

HandClap flac

Fitz And The Tantrums. 2017. Writer: Fitz And The Tantrums;Eric Frederic;Sam Hollander.
12 Diplo

Close To Me flac

Diplo. 2018. Writer: Ellie Goulding;Savan Kotecha;Peter Svensson;Ilya;Swae Lee;Diplo.
13 The Chainsmokers

Beach House flac

The Chainsmokers. 2018. Writer: Andrew Taggart.
14 Bradley Cooper

Always Remember Us This Way flac

Bradley Cooper. 2018. Writer: Lady Gaga;Dave Cobb.
15 Kelly Clarkson

Never Enough flac

Kelly Clarkson. 2018. Writer: Benj Pasek;Justin Paul.
16 Lady Gaga

I'll Never Love Again flac

Lady Gaga. 2018. Writer: Benjamin Rice;Lady Gaga.
17 Frida Sundemo

Apologize flac

Frida Sundemo. 2018.
18 Little Mix

Woman Like Me flac

Little Mix. 2018. Writer: Nicki Minaj;Steve Mac;Ed Sheeran;Jess Glynne.
19 Imagine Dragons

Machine flac

Imagine Dragons. 2018. Writer: Wayne Sermon;Daniel Platzman;Dan Reynolds;Ben McKee;Alex Da Kid.
20 Billie Eilish

When The Party's Over flac

Billie Eilish. 2018. Writer: Billie Eilish;FINNEAS.

Related questions

Hot questions

Language

Popular Tags