Ubuntu下的NDK配置

本文介绍了如何在Ubuntu操作系统上配置Android NDK。首先从官方源下载NDK bin文件,将其移动到/opt目录下,然后编辑/etc/profile文件添加NDK路径到环境变量,并通过source命令使配置生效。最后通过运行'ndk-build'命令验证NDK已成功配置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

NDK官方下载地址

从官网下载后得到一个bin文件

然后输入

ndk$ chmod a+x android-ndk-r10e-linux-x86_64.bin
ndk$ ./android-ndk-r10e-linux-x86_64.bin
会的到一个   android-ndk-r10e  文件夹

然后把文件夹移到 /opt 文件夹下

sudo mv android-ndk-r10e /opt/

接着修改 /etc/profile 

输入  sudo vim /etc/profile

在最后加上

#set NDK env
export NDKROOT="/opt/android-ndk-r10e"
export PATH=$NDKROOT:$PATH

保存退出

输入source /etc/profile  让配置文件生效

然后测试ndk是否生效  

输入  ndk-build

Android NDK: Could not find application project directory !    
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.    
/opt/android-ndk-r10e/build/core/build-local.mk:143: *** Android NDK: Aborting    .  Stop.

出现上面的内容说明已经生效

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值