Android NDK环境搭建

本文主要记录NDK环境在Ubuntu下的搭建。

下载NDK

在官网进行下载NDK https://developer.android.com/ndk/downloads/index.html

当前最新版为r15b。然后进行解压,解压到~/bin下,得到~/bin/android-ndk-r15b

配置环境变量

编辑~/.bashrc文件 ,在最后添加如下内容:

NDK=~/bin/android-ndk-r15b
export NDK

保存后,使用如下命令执行一下该脚本:

$ source ~/.bashrc

执行以下命令查看是否配置成功:

$ echo $NDK
/home/mn/bin/android-ndk-r15b
$ $NDK/ndk-build -v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-pc-linux-gnu

以下两个命令都输出正常,说明配置成功了。

NDK命令的使用

使用时就像上面验证一样:

$ $NDK/ndk-build

(完)

原文地址:https://www.cnblogs.com/furzoom/p/7710127.html