简体   繁体   English

无法在 android studio 上配置 NDK 路径

[英]Can't Configure NDK path on android studio

I have an android studio project which requires the NDK to be set.我有一个 android 工作室项目,需要设置 NDK。 I had downloaded an NDK manually and extracted it to a directory in my C: drive.我手动下载了一个 NDK 并将其解压缩到我的 C: 驱动器中的一个目录中。 What I did was to follow the instructions which are online and I went to: File->Project structure, and tried to set the NDK path.我所做的是按照在线说明进行操作,然后转到:文件->项目结构,并尝试设置 NDK 路径。 But the search box there was disabled as shown in the image,但是如图所示,那里的搜索框被禁用了,

在此处输入图像描述

I then set environment variables to point where the ndk was located.然后我将环境变量设置为指向 ndk 所在的位置。 Here are the names I used for the environment variables: "ANDROID_NDK_ROOT" and later "ANDROID_NDK_HOME" when the former didn't work.这是我用于环境变量的名称:“ANDROID_NDK_ROOT”和后来的“ANDROID_NDK_HOME”,前者不起作用。

So I clicked on the Download button below the disabled search box.所以我点击了禁用搜索框下方的下载按钮。 After letting android studio do its thing and download another NDK, I restarted android studio, just find out that the search box was disabled, and I couldn't set the NDK path.让android studio搞定再下载一个NDK后,重启android studio,发现搜索框被禁用了,无法设置NDK路径。

Then I went to SDK Manager -> SDK Tools -> I checked the android NDK and CMAKE, then waited for it to download.然后我去了 SDK Manager -> SDK Tools -> 我检查了 android NDK 和 CMAKE,然后等待它下载。

But after downloading again, android studio still couldn't find the NDK.但是再次下载后,android studio还是找不到NDK。 I set the environment variables and even restarted my PC.我设置了环境变量,甚至重新启动了我的电脑。

This thing is extremely frustrating, what the hell have I done wrong?这件事非常令人沮丧,我到底做错了什么? Please can someone tell me?请问有人可以告诉我吗?

Open local.properties and add打开 local.properties 并添加

ndk.dir=C:\Users\PC\AppData\Local\Android\Sdk\ndk\ndkversion ndk.dir=C:\Users\PC\AppData\Local\Android\Sdk\ndk\ndkversion

download ndk if previously not exist in directory如果先前不存在于目录中,则下载 ndk

https://developer.android.com/ndk/downloads https://developer.android.com/ndk/downloads

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM