JNI基础(一)Android Studio 配置NDK

来源:互联网 发布:闵行区拆违数据 编辑:程序博客网 时间:2024/05/27 00:45

Android Stduio配置NDK步骤:


一:下载NDK工具包,网上很多,自行在下。

二:解压工具包,获得ndk-bundle文件夹,一般会将此文件夹放入SDK的根目录下,方便寻找(放哪不影响使用,但路径不能有空格和中文)。

三:配置NDK环境变量,在Path环境变量添加ndk-bundle路径。

四:新建项目在local.properites文件中加入ndk-bundle的路径,例如:

## This file is automatically generated by Android Studio.# Do not modify this file -- YOUR CHANGES WILL BE ERASED!## This file must *NOT* be checked into Version Control Systems,# as it contains information specific to your local configuration.## Location of the SDK. This is only used by Gradle.# For customization when using a Version Control System, please read the# header note.#Fri Dec 23 10:21:35 CST 2016ndk.dir=E\:\\Android\\sdk\\ndk-bundlesdk.dir=E\:\\Android\\sdk

格式如上,ndk-bundle的路径为E:\Android\sdk\ndk-bundle  ,但是 :,\这样的符号需要加转义。所以配置完就是如上所示红色代码。

五:在gradle.properites文件中加入

android.useDeprecatedNdk=true
表示兼容低版本NDK,可加可不加。


0 0
原创粉丝点击