linux安装android NDK

http://blog.chinaunix.net/uid-20680966-id-4961541.html


编译JNI,如果没有NDK,会出错
Error:Execution failed for task ':app:compileDebugNdk'.
> NDK not configured.
  Download the NDK from http://developer.android.com/tools/sdk/ndk/.Then add ndk.dir=path/to/ndk in local.properties.
    (On Windows, make sure you escape backslashes, e.g. C:\ndk rather than C: dk)

官网,有墙,最好自己弄个VPN
https://developer.android.com/tools/sdk/ndk/index.html
找到自己平台的下载包,我的
Linux 64-bit (x86)  android-ndk-r10d-linux-x86_64.bin

以下下载地址,直接放到浏览器中下载,不需要VPN
linux 32 bit
http://dl.google.com/android/ndk/android-ndk-r10d-linux-x86.bin
linux 64 bit
http://dl.google.com/android/ndk/android-ndk-r10d-linux-x86_64.bin

Windows 32 bit
http://dl.google.com/android/ndk/android-ndk-r10d-windows-x86.exe
64 bit
http://dl.google.com/android/ndk/android-ndk-r10d-windows-x86_64.exe

Mac OS X 32 bit
http://dl.google.com/android/ndk/android-ndk-r10d-darwin-x86.bin
64 bit
http://dl.google.com/android/ndk/android-ndk-r10d-darwin-x86_64.bin

安装方法:
请确保你已安装了Android SDK
Linux 与Mac OS X (Darwin):
打开终端,进入到你下载包所在的目录
执行chmod a+x 下载包名, 使其可执行,然后执行安装包就行
比如:
ndk$ chmod a+x android-ndk-r10c-darwin-x86_64.bin
ndk$ ./android-ndk-r10c-darwin-x86_64.bin
          
windows安装相对容易,直接双击安装包

假设解压出来的目录在path/to/ndk下
在android studio工程的local.properties文件中加入 ndk.dir=path/to/ndk 
或者设置ANDROID_NDK_HOME环境变量为path/to/ndk  比如在~/.bashrc中加上 export ANDROID_NDK_HOME=/opt/android-ndk-r10d然后重启
作者:帅得不敢出门  程序员群:31843264
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
阅读(98) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
原文地址:https://www.cnblogs.com/ztguang/p/12648770.html