Gradle同步失败,未配置NDK,请使用SDK管理器下载 [英] Gradle sync failed, NDK not configured, download it with SDK manager

查看:805
本文介绍了Gradle同步失败,未配置NDK,请使用SDK管理器下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Android开发的新手,刚刚安装了Android Studio.我正在做一个非常基本的HelloGL2练习,我打开了HelloGL2.iml文件.我尝试运行它,但是它说gradle项目同步失败,并且未配置NDK.用最简单的术语(对于Android中的初学者而言),该如何解决?

I am completely new to Android development and just installed Android Studio. I'm doing a very basic HelloGL2 exercise, and I opened up the HelloGL2.iml file. I tried running it, but it said that the gradle project sync failed and that the NDK is not configured. In the simplest terms (to a complete beginner in Android), how do I fix this?

推荐答案

我仔细检查了我是否已经安装了最新的NDK(因此这不是我的解决方案).接下来,我执行以下操作:Android Studio菜单->文件->项目结构-> SDK位置.在这里,没有选择NDK,所以我选择了最新版本.这样就解决了问题.

I double-checked that I already had the latest NDK installed (so that wasn't the solution for me). Next I did the following: Android Studio Menu -> File -> Project structure -> SDK Location. Here, no NDK was selected, so I selected the latest version. This solved the problem.

通过将您的选择写入项目根目录中的local.properties文件,此修补程序仅适用于该特定计算机和该项目在本地.

This fix only works locally for this particular machine and for this project by writing your choice to the local.properties file in your project's root.

更新:还有一种方法可以通过ANDROID_NDK_HOME环境变量进行全局设置.这就是我调用构建服务器上的项目的方式:

UPDATE: There's also a way to set this globally via ANDROID_NDK_HOME environment variable. This is how I invoke building my project on a build server:

export ANDROID_SDK_ROOT=/home/jenkins/Android/Sdk/; export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk/21.0.6113669; ./gradlew assembleRelease

这篇关于Gradle同步失败,未配置NDK,请使用SDK管理器下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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