android studio如何配置环境变量并实现native方法

来源:互联网 发布:java 互联网金融项目 编辑:程序博客网 时间:2024/06/18 04:30

一、下载并配置android studio NDk环境变量:

 二、编写本地方法(native)并加载动态so库和调用;

、命令生成 .h文件 ,在项目的java下 :javah -jni com.yang.user.androidjnidemo.MainActivity

四、.gradle配置

、编译错误排查:

编译过程出现了Error:(13, 1) A problem occurred evaluating project ':app'.
Error: NDK integration is deprecated in the current plugin. Consider trying the new experimental plugin. For details, see http://tools.android.com/tech-docs/new-build-system/gradle-experimental. Set "android.useDeprecatedNdk=true" in gradle.properties to continue using the current NDK integration.

提示已经告诉我们需要在gradle.properties设置android.useDeprecatedNdk=true,设置好后点击同步按钮。


当然。在此过程中最重要的还是我们去实现本地方法.c文件的实现;这个就不多说了,我们自由发挥。哈哈

阅读全文
0 0
原创粉丝点击