android native调用
16lz
2021-01-25
1、c++中的方法Java_xxx_xxx 中的Java 首字母一定要大写
2、如果是 .cpp 文件 则用 extern "C" {"您的方法在这里"},大括号里是您的本地方法
#include <string.h>#include <jni.h>#ifdef __cplusplus //最好有这个,否则被编译器改了函数名字找不到不要怪我extern "C" {#endifJNIEXPORT jstring JNICALL Java_com_example_grayprocess3_MainActivity_sayHello(JNIEnv* env, jclass obj){return env->NewStringUTF("dongxh");}#ifdef __cplusplus}#endif
更多相关文章
- Android(安卓)学习笔记 databinding简单使用:使用databinding在li
- android学习日记之fragment
- android 反射应用
- not using the 2- or 3-argument View constructors
- android关于输入法弹出时的UI变动
- Android(安卓)onCreateOptionsMenu的使用方法总结
- Android实现虚线的方法
- Android设置图片圆角的方法
- Android:Java Native Interface入门