如何在 OSX 中为 Android Studio 设置 NDK 构建路径 [英] How to set NDK Build path in OSX for Android studio
问题描述
我使用名为 ANDROID_NDK_HOME 设置为 /Users/Shajilshocker/Documents/Android/NDK/android-ndk-r10b
>环境变量.
I had set the ANDROID_NDK_HOME
as /Users/Shajilshocker/Documents/Android/NDK/android-ndk-r10b
using a mac osx application called Environment Variables.
我已经确认它在终端中正确设置了路径
I had confirmed that it set the path correctly in Terminal
echo $ANDROID_NDK_HOME
但是当我在调用 ndk-build
的 Android Studio 项目中运行 shell 文件时,我收到以下错误
But when I run a shell file in a Android Studio project which invokes ndk-build
I get the following error
ndk-build:找不到命令
如何确保 ndk-build 在您的构建路径中?
How to make sure that ndk-build is in your build path ?
如何在我的构建路径中设置 ndk-build ?
How to set ndk-build in my build path ?
感谢您的帮助
推荐答案
嗯,这实际上还不足以让系统知道路径.您必须将此路径添加到 PATH
系统变量.在您的情况下,您所要做的就是将以下行添加到您的终端配置文件中(如果您保留默认终端的完整路径,则该文件应该位于您的主目录下,名为 .bashrc
:<代码>~/.bashrc):
Well, this is actually not enough to make the system aware of the path. You must add this path to the PATH
system variable. In your case, all you have to do is to add the following line to your terminal configuration file (which should be under your home directory, named .bashrc
if you kept the default terminal, full path: ~/.bashrc
):
export PATH=$PATH:/Users/Shajilshocker/Documents/Android/NDK/android-ndk-r10b
这一行实际上是将 Android NDK 目录的路径添加到 PATH
变量中.您导出名为 PATH
的变量及其当前内容和 NDK 目录.
What this line does is actually adding the path to your Android NDK directory to the PATH
variable. You export a variable named PATH
with its current content plus the directory of your NDK.
循序渐进:
- 进入主目录
- 编辑
.bashrc
- 添加我上面显示的行
- 保存,退出,然后重启bash(你只需要输入
bash
,然后回车)
- Go in the home directory
- Edit
.bashrc
- Add the line I showed above
- Save, exit, then restart bash (you just have to type
bash
, then enter)
这篇关于如何在 OSX 中为 Android Studio 设置 NDK 构建路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!