升级安装了 Android-Studio Ubuntu 18.04 的 CMake 版本 [英] Upgrade CMake version installed with Android-Studio Ubuntu 18.04

查看:49
本文介绍了升级安装了 Android-Studio Ubuntu 18.04 的 CMake 版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在 Ubuntu 18.04 上安装了 Android Studio,以便为 Android 进行一些本机 C++ 开发.在编译需要 cmake 3.9 或更高版本(由于 cmake 依赖)的项目时,我发现 Android Studio 安装的 cmake 版本仅为 3.6 版本.是否有一种干净的方法可以通过 SDK 管理器升级与 Android Studio 一起安装的 cmake 版本?

I recently installed Android Studio on Ubuntu 18.04 to do some native C++ development for Android. While compiling a project that required cmake 3.9 or higher (due to cmake dependencies) I found that the cmake version installed by Android Studio was only version 3.6. Is there a clean way to upgrade the cmake version installed with Android Studio via the SDK Manager?

我正在运行 Android Studio 3.1.3 版并从 SDK Manager -> SDK 工具安装了 cmake.

I'm running Android Studio version 3.1.3 and Installed cmake from SDK Manager -> SDK tools.

推荐答案

来自官方 文档

SDK 管理器包括 CMake 的分支版本,最高版本为 3.6.4.如果您想使用 CMake 版本 3.7 或更高版本,请执行以下操作:

The SDK Manager includes forked versions of CMake up to version 3.6.4. If you want to use CMake version 3.7 or higher, proceed as follows:

  1. 将 Android Studio 更新到 3.0 或更高版本,并将 Gradle 的 Android 插件更新到 3.0.0 或更高版本.

  1. Update Android Studio to 3.0 or higher, and update the Android plugin for Gradle to 3.0.0 or higher.

从 CMake 官方网站下载并安装 CMake 3.7 或更高版本.

Download and install CMake 3.7 or higher from the official CMake website.

在模块的 build.gradle 文件中指定您希望 Gradle 使用的 CMake 版本:

Specify the CMake version you want Gradle to use in your module's build.gradle file:

android {外部原生构建{制作{版本3.7.1"}}}

将 CMake 安装的路径添加到您的 PATH 环境变量中,或者将其包含在您项目的 local.properties 文件中,如 cmake.dir="path-to-cmake".如果 Gradle 无法找到您在 build.gradle 文件中指定的 CMake 版本,您会收到构建错误.如果您设置此属性,Gradle 将不再使用 PATH 来查找 CMake.

Either add the path to the CMake installation to your PATH environment variable or include it in your project's local.properties file, as cmake.dir="path-to-cmake". If Gradle is unable to find the version of CMake you specified in your build.gradle file, you get a build error. If you set this property, Gradle no longer uses PATH to find CMake.

希望能帮到你!

这篇关于升级安装了 Android-Studio Ubuntu 18.04 的 CMake 版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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